Issue #1555: Replace for loop that misses component with while loop

Fixes `ForLoopWithMissingComponent` inspection violation.

Description:
>Reports for loops that lack initialization, condition, or update clauses. Some coding styles prohibit such loops.
This commit is contained in:
Michal Kordas 2015-08-29 21:46:27 +02:00 committed by Roman Ivanov
parent 1ad7c80579
commit 7b0388ee96
1 changed files with 2 additions and 2 deletions

View File

@ -235,13 +235,13 @@ public final class ParameterAssignmentCheck extends Check {
DetailAST parameterDefAST =
ast.findFirstToken(TokenTypes.PARAMETER_DEF);
for (; parameterDefAST != null;
parameterDefAST = parameterDefAST.getNextSibling()) {
while (parameterDefAST != null) {
if (parameterDefAST.getType() == TokenTypes.PARAMETER_DEF) {
final DetailAST param =
parameterDefAST.findFirstToken(TokenTypes.IDENT);
parameterNames.add(param.getText());
}
parameterDefAST = parameterDefAST.getNextSibling();
}
}
}