checkstyle
checkstyle copied to clipboard
Issue #13553: False positive in FallThroughCheck on last case
Fix for Issue #13553, Continue of #14016
Config
<module name="FallThrough">
<property name="checkLastCaseGroup" value="true"/>
</module>
Regression Report
https://checkstyle-diff-reports.s3.us-east-2.amazonaws.com/8a0a354_2024060435/reports/diff/checkstyle/index.html 5 violations are removed in Checkstyle code base. Differences in this report are intended.
For example: https://github.com/checkstyle/checkstyle/blob/4fe811819594747bcce6f62c216ea133c3cd2954/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/fallthrough/InputFallThrough4.java#L109
void method5(int i, int j, boolean cond) {
while (true) {
switch (i){
case 5: // violation 'Fall\ through from the last branch of the switch statement'
i++;
/* block */ /* fallthru */ // comment
}
}
}
This is no longer a violation in this case. Same for the other 4 cases.
Diff Regression config: https://gist.githubusercontent.com/Lmh-java/55bdd9e289522aff23374ad7b5571c2c/raw/4e52c69d3888eff5f976f0ae87c058e98c0dd72d/input-fall-thru-config.xml
GitHub, generate report
https://checkstyle-diff-reports.s3.us-east-2.amazonaws.com/8a0a354_2024060435/reports/diff/index.html
@nrmancuso @romani please take a look.
Rebasing on latest master, good to merge
Edit: I am removing this. Property is additive, not either/or.
GitHub, generate report
https://checkstyle-diff-reports.s3.us-east-2.amazonaws.com/7e9dba3_2024170824/reports/diff/index.html
Latest review discussion is at https://github.com/checkstyle/checkstyle/pull/14734#discussion_r1597719839
Moved to https://github.com/checkstyle/checkstyle/pull/15405