@Override
 public void visitForStatement(PsiForStatement statement) {
   super.visitForStatement(statement);
   final PsiExpression condition = statement.getCondition();
   final PsiStatement body = statement.getBody();
   checkCondition(condition, body);
 }
 @Override
 public void visitForStatement(@NotNull PsiForStatement statement) {
   super.visitForStatement(statement);
   if (conditionUsesInitializer(statement)) {
     if (!updateUsesInitializer(statement)) {
       registerStatementError(statement, Boolean.FALSE, Boolean.TRUE);
     }
   } else {
     if (updateUsesInitializer(statement)) {
       registerStatementError(statement, Boolean.TRUE, Boolean.FALSE);
     } else {
       registerStatementError(statement, Boolean.TRUE, Boolean.TRUE);
     }
   }
 }
 @Override
 public void visitForStatement(
   @NotNull PsiForStatement forStatement) {
   super.visitForStatement(forStatement);
   if (!PsiUtil.isLanguageLevel5OrHigher(forStatement)) {
     return;
   }
   if (isArrayLoopStatement(forStatement)
       || isCollectionLoopStatement(forStatement,
                                    ignoreUntypedCollections)
       || (REPORT_INDEXED_LOOP &&
           isIndexedListLoopStatement(forStatement,
                                      ignoreUntypedCollections))) {
     registerStatementError(forStatement);
   }
 }
 @Override
 public void visitForStatement(@NotNull PsiForStatement statement) {
   super.visitForStatement(statement);
   final PsiStatement initialization = statement.getInitialization();
   if (!(initialization instanceof PsiDeclarationStatement)) {
     return;
   }
   final PsiDeclarationStatement declaration = (PsiDeclarationStatement) initialization;
   final PsiElement[] declaredElements = declaration.getDeclaredElements();
   if (declaredElements.length != 1) {
     return;
   }
   final PsiElement declaredElement = declaredElements[0];
   if (!(declaredElement instanceof PsiLocalVariable)) {
     return;
   }
   final PsiLocalVariable variable = (PsiLocalVariable) declaredElement;
   final PsiExpression initialValue = variable.getInitializer();
   if (initialValue == null) {
     return;
   }
   final PsiExpression condition = statement.getCondition();
   if (!ExpressionUtils.isVariableLessThanComparison(condition, variable)) {
     return;
   }
   final PsiStatement update = statement.getUpdate();
   if (!VariableAccessUtils.variableIsIncremented(variable, update)) {
     return;
   }
   final PsiArrayAccessExpression arrayAccessExpression = getArrayAccessExpression(statement);
   if (arrayAccessExpression == null) {
     return;
   }
   final PsiExpression arrayExpression = arrayAccessExpression.getArrayExpression();
   final PsiType type = arrayExpression.getType();
   if (!(type instanceof PsiArrayType)
       || type.getDeepComponentType() instanceof PsiPrimitiveType) {
     return;
   }
   final PsiStatement body = statement.getBody();
   if (!bodyIsArrayToCollectionCopy(body, variable, true)) {
     return;
   }
   registerStatementError(statement);
 }