Issue #1286: 'ModifierOrderCheck' was refactored, UT coverage improved; .classpath and .project were added to ignore list

This commit is contained in:
Ruslan Diachenko 2015-07-03 01:29:18 +03:00 committed by Roman Ivanov
parent 93c68168f3
commit 0ff261c5ac
3 changed files with 7 additions and 6 deletions

2
.gitignore vendored
View File

@ -3,6 +3,8 @@
#.project till https://issues.apache.org/jira/browse/MECLIPSE-735
.settings
.externalToolBuilders
.classpath
.project
# Eclipse-CS Checkstyle Plug-In IDE configuration files
.checkstyle

View File

@ -872,7 +872,6 @@
<regex><pattern>.*.checks.metrics.NPathComplexityCheck</pattern><branchRate>100</branchRate><lineRate>90</lineRate></regex>
<regex><pattern>.*.checks.modifier.ModifierOrderCheck</pattern><branchRate>92</branchRate><lineRate>94</lineRate></regex>
<regex><pattern>.*.checks.modifier.RedundantModifierCheck</pattern><branchRate>97</branchRate><lineRate>96</lineRate></regex>

View File

@ -149,7 +149,7 @@ public class ModifierOrderCheck
}
int i = 0;
while (i < JLS_ORDER.length) {
while (modifier != null) {
if (modifier.getType() == TokenTypes.ANNOTATION) {
//Annotation not at start of modifiers, bad
return modifier;
@ -164,12 +164,12 @@ public class ModifierOrderCheck
//Current modifier is out of JLS order
return modifier;
}
else if (!it.hasNext()) {
//Reached end of modifiers without problem
return null;
else if (it.hasNext()) {
modifier = it.next();
}
else {
modifier = it.next();
//Reached end of modifiers without problem
modifier = null;
}
}