Skip to content

Instantly share code, notes, and snippets.

@stubillwhite
Last active August 29, 2015 14:10
Show Gist options
  • Save stubillwhite/a96545347e471e2284e7 to your computer and use it in GitHub Desktop.
Save stubillwhite/a96545347e471e2284e7 to your computer and use it in GitHub Desktop.
Test case for Checkstyle behaviour change between 5.9 and 6.0 for Javadoc referencing checked exception that is not thrown
Output for run-checkstyle-5.9.bat
--
Starting audit...
C:\TRASH\checkstyle-behaviour-change\ExceptionJavadoc.java:8:8: warning: Unused @throws tag for 'java.io.IOException'.
Audit done.
Output for run-checkstyle-6.0.bat
--
Starting audit...
Audit done.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<property name="severity" value="warning"/>
<module name="TreeWalker">
<module name="JavadocMethod">
<property name="scope" value="protected"/>
<property name="allowMissingThrowsTags" value="true"/>
<property name="logLoadErrors" value="true"/>
<property name="suppressLoadErrors" value="true"/>
<property name="allowUndeclaredRTE" value="true" />
</module>
</module>
</module>
/**
* This is my class.
*/
public final class ExceptionJavadoc
{
/**
* This is a method.
* @throws java.io.IOException sometimes.
*/
public void badMethod()
{
// Bad method Javadocs a CHECKED exception that isn't declared in the throws clause.
}
}
@echo off
java -cp checkstyle-5.9-all.jar com.puppycrawl.tools.checkstyle.Main -c CheckstyleConfig.xml ExceptionJavadoc.java
@echo off
java -cp checkstyle-6.0-all.jar com.puppycrawl.tools.checkstyle.Main -c CheckstyleConfig.xml ExceptionJavadoc.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment