(This RFE is following up parts of RFE 1245942, which
contained two topics. Many thanks for the fix of RFE
According to Sun's conventions
in §7.8, every time when a case falls through
intentionally, a comment should be added where the
break statement would normally be. They suggest the
/ falls through /
but I have seen different comments for this purpose, so
this should be a regexp parameter to the check.
Of course, the FallsThroughCheck should not alert if the
comment is there.
The obvious Checkstyle solution is to use a
SuppressionCommentFilter. But this is inferior, as this
filter has to be turned on - and later off again. Here is my
try, at least it is turning the check off as expected, and
any comment is turning it on again. But what if there is
no such comment?
<property name="offCommentFormat" value=" falls through"/>
<property name="onCommentFormat" value=""/>
<property name="checkFormat" value="FallThroughCheck"/>
Accounting for the comment is not easy, I assume,
as the AST seems not to contain the comments
(although ANTLR could include them).
Log in to post a comment.