void (PsiExpression occurence, MultiMap<PsiElement, String> conflicts) { final PsiElement loopForLoopCondition = RefactoringUtil.getLoopForLoopCondition(occurence); if (loopForLoopCondition == null || loopForLoopCondition instanceof PsiWhileStatement) return; final List<PsiVariable> referencedVariables = RefactoringUtil.collectReferencedVariables(occurence); final List<PsiVariable> modifiedInBody = new ArrayList<>(); for (PsiVariable psiVariable : referencedVariables) { if (RefactoringUtil.isModifiedInScope(psiVariable, loopForLoopCondition)) { modifiedInBody.add(psiVariable); } } if (!modifiedInBody.isEmpty()) { for (PsiVariable variable : modifiedInBody) { final String message = JavaRefactoringBundle.message("is.modified.in.loop.body", RefactoringUIUtil.getDescription(variable, false)); conflicts.putValue(variable, StringUtil.capitalize(message)); } conflicts.putValue(occurence, JavaRefactoringBundle.message("introducing.variable.may.break.code.logic")); } }