diff --git a/.gitignore b/.gitignore
index 7b5c2c725..e8f2af879 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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
diff --git a/pom.xml b/pom.xml
index bfed38ace..39ed7e6a7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -872,7 +872,6 @@
.*.checks.metrics.NPathComplexityCheck10090
- .*.checks.modifier.ModifierOrderCheck9294
.*.checks.modifier.RedundantModifierCheck9796
diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/modifier/ModifierOrderCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/modifier/ModifierOrderCheck.java
index 5b5712a40..b0a2e7e18 100644
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/modifier/ModifierOrderCheck.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/modifier/ModifierOrderCheck.java
@@ -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;
}
}