Issue #2661: Enforce SingleBreakOrContinueCheck of sevntu-checkstyle over Checkstyle source code

This commit is contained in:
Yasser Aziza 2015-12-27 14:21:35 +01:00 committed by Roman Ivanov
parent e230f7ac55
commit 2f3b62ed73
2 changed files with 7 additions and 4 deletions

View File

@ -139,5 +139,6 @@
</module>
<module name="LogicConditionNeedOptimizationCheck"/>
<module name="AvoidConditionInversionCheck"/>
<module name="SingleBreakOrContinueCheck"/>
</module>
</module>

View File

@ -256,13 +256,15 @@ public class RedundantModifierCheck
final DetailAST classModifiers =
parent.findFirstToken(TokenTypes.MODIFIERS);
checkFinal = checkFinal || classModifiers.branchContains(TokenTypes.FINAL);
break;
parent = null;
}
if (parent.getType() == TokenTypes.LITERAL_NEW) {
else if (parent.getType() == TokenTypes.LITERAL_NEW) {
checkFinal = true;
break;
parent = null;
}
else {
parent = parent.getParent();
}
parent = parent.getParent();
}
if (checkFinal && !isAnnotatedWithSafeVarargs(ast)) {
DetailAST modifier = modifiers.getFirstChild();