void (Map<PsiVariable, List<PsiMethodCallExpression>> calls) { calls.forEach((variable, varCalls) -> { if (distinctCalls(varCalls) < 2) return; PsiExpression[] occurrences = varCalls.toArray(PsiExpression.EMPTY_ARRAY); PsiElement anchor = CommonJavaRefactoringUtil.getAnchorElementForMultipleExpressions(occurrences, myScope); if (anchor == null) return; boolean needsTryCatchBlock = needsTryCatchBlock(anchor); if (!needsTryCatchBlock) { varCalls.forEach(call -> myHolder.registerProblem(call, JavaBundle.message("inspection.bulk.file.attributes.read.message"), new ReplaceWithBulkCallFix())); return; } if (myIsOnTheFly) { varCalls.forEach(call -> myHolder.registerProblem(call, JavaBundle.message("inspection.bulk.file.attributes.read.message"), ProblemHighlightType.INFORMATION, new ReplaceWithBulkCallFix())); } }); }