void (@NotNull PsiForStatement statement) { super.visitForStatement(statement); CountingLoop loop = CountingLoop.from(statement); if (loop == null || loop.isIncluding() || loop.isDescending()) return; if (!ExpressionUtils.isZero(loop.getInitializer())) return; PsiAssignmentExpression assignment = ExpressionUtils.getAssignment(ControlFlowUtils.stripBraces(statement.getBody())); if (assignment == null) return; IndexedContainer container = getContainer(loop, assignment); if (container == null || !(container.getQualifier().getType() instanceof PsiArrayType)) return; PsiExpression index = container.extractIndexFromGetExpression(assignment.getLExpression()); if (!ExpressionUtils.isReferenceTo(index, loop.getCounter())) return; PsiExpression rValue = assignment.getRExpression(); if (rValue == null) return; if (!isChangedInLoop(loop, rValue)) { PsiType lType = container.getElementType(); Object defaultValue = PsiTypesUtil.getDefaultValue(lType); if (isDefaultValue(rValue, defaultValue, lType) && isFilledWithDefaultValues(container.getQualifier(), statement, defaultValue)) { holder.registerProblem(statement, getRange(statement, ProblemHighlightType.WARNING), JavaBundle.message("inspection.explicit.array.filling.redundant.loop.description"), QuickFixFactory.getInstance() .createDeleteFix(statement, CommonQuickFixBundle.message("fix.remove.statement", PsiKeyword.FOR))); return; } registerProblem(statement, false); return; } if (!JavaFeature.ADVANCED_COLLECTIONS_API.isFeatureSupported(holder.getFile())) return; if (!StreamApiUtil.isSupportedStreamElement(container.getElementType())) return; if (!LambdaGenerationUtil.canBeUncheckedLambda(rValue, Predicate.isEqual(loop.getCounter()))) return; registerProblem(statement, true); }