void (@NotNull List<? extends PsiExpression> occurrences, @NotNull PsiCodeBlock body) { if (occurrences.size() > 1 && areSafeToExtract(occurrences, body)) { Map<PsiExpression, List<PsiVariable>> reusableVariables = collectReusableVariables(occurrences); for (PsiExpression occurrence : occurrences) { List<LocalQuickFix> fixes = new ArrayList<>(); List<PsiVariable> variables = reusableVariables.get(occurrence); if (variables != null) { for (PsiVariable variable : variables) { fixes.add(new ReuseVariableFix(occurrence, variable)); } } PsiVariable variable = findVariableByInitializer(occurrence); if (variable != null && canReplaceOtherOccurrences(occurrence, occurrences, variable)) { fixes.add(new ReplaceOtherOccurrencesFix(occurrence, variable)); } else if (isOnTheFly) { fixes.add(new IntroduceVariableFix(occurrence)); } holder.registerProblem(occurrence, JavaBundle.message("inspection.duplicate.expressions.message"), fixes.toArray(LocalQuickFix.EMPTY_ARRAY)); } } }