Issue #3582: marked enum field's final method as redundant
This commit is contained in:
parent
0b36159898
commit
39cafcc5bb
|
|
@ -278,7 +278,8 @@ public class RedundantModifierCheck
|
|||
checkFinal = checkFinal || classModifiers.branchContains(TokenTypes.FINAL);
|
||||
parent = null;
|
||||
}
|
||||
else if (parent.getType() == TokenTypes.LITERAL_NEW) {
|
||||
else if (parent.getType() == TokenTypes.LITERAL_NEW
|
||||
|| parent.getType() == TokenTypes.ENUM_CONSTANT_DEF) {
|
||||
checkFinal = true;
|
||||
parent = null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -227,7 +227,10 @@ public class RedundantModifierCheckTest
|
|||
@Test
|
||||
public void testEnumMethods() throws Exception {
|
||||
final DefaultConfiguration checkConfig = createCheckConfig(RedundantModifierCheck.class);
|
||||
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
|
||||
final String[] expected = {
|
||||
"7:16: " + getCheckMessage(MSG_KEY, "final"),
|
||||
"22:16: " + getCheckMessage(MSG_KEY, "final"),
|
||||
};
|
||||
verify(checkConfig, getPath("InputFinalInEnumMethods.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue