I have read check documentation: https://checkstyle.org/checks/coding/fallthrough.html#FallThrough
I have downloaded the latest checkstyle from: https://checkstyle.org/cmdline.html#Download_and_Run
I have executed the cli and showed it below, as cli describes the problem better than 1,000 words
Config
kevin@inspiron-15-5510:~/Desktop/check_style$ cat config.xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="TreeWalker">
<module name="FallThrough">
<property name="checkLastCaseGroup" value="true"/>
</module>
</module>
</module>
code
kevin@inspiron-15-5510:~/Desktop/check_style$ cat Test.java
class Test {
void method5(int i, int j, boolean cond) {
while (true) {
switch (i){
case 5:
i++;
/* block */ /* fallthru */ // comment
}
}
}
}
output
$ java -jar checkstyle-10.12.4-all.jar -c config.xml Test.java
Starting audit...
[ERROR] /var/tmp/Test.java:5:11: Fall through from the last branch of the switch statement. [FallThrough]
Audit done.
Checkstyle ends with 1 errors.
Expected
No violation
Update in doc to remove:
The comment containing these words must be all on one line
I have read check documentation: https://checkstyle.org/checks/coding/fallthrough.html#FallThrough
I have downloaded the latest checkstyle from: https://checkstyle.org/cmdline.html#Download_and_Run
I have executed the cli and showed it below, as cli describes the problem better than 1,000 words
Config
code
output
Expected
No violation
Update in doc to remove: