void (@NotNull PsiMethodCallExpression call) { super.visitMethodCallExpression(call); if (!SET_REMOVE_ALL.test(call)) return; final PsiExpression qualifier = ExpressionUtils.getEffectiveQualifier(call.getMethodExpression()); if (qualifier == null) return; final PsiExpression arg = call.getArgumentList().getExpressions()[0]; final TypeConstraint constraint = TypeConstraint.fromDfType(CommonDataflow.getDfType(arg)); final PsiType type = constraint.getPsiType(holder.getProject()); if (!InheritanceUtil.isInheritor(type, CommonClassNames.JAVA_UTIL_LIST)) return; final TypeConstraint qualifierConstraint = TypeConstraint.fromDfType(CommonDataflow.getDfType(qualifier)); final PsiType qualifierType = qualifierConstraint.getPsiType(holder.getProject()); if (InheritanceUtil.isInheritor(qualifierType, "java.util.concurrent.CopyOnWriteArraySet")) return; final LongRangeSet setSizeRange = getSizeRangeOfCollection(qualifier); if (setSizeRange.isEmpty() || setSizeRange.max() <= 1) return; final LongRangeSet listSizeRange = getSizeRangeOfCollection(arg); if (listSizeRange.isEmpty() || listSizeRange.max() <= 2) return; if (setSizeRange.min() > listSizeRange.max()) return; final LocalQuickFix[] fix; if (PsiUtil.isLanguageLevel8OrHigher(call) && ExpressionUtils.isVoidContext(call)) { final String replacement = ParenthesesUtils.getText(arg, ParenthesesUtils.POSTFIX_PRECEDENCE) + ".forEach(" + qualifier.getText() + "::remove)"; fix = new LocalQuickFix[]{new ReplaceWithListForEachFix(replacement)}; } else { fix = LocalQuickFix.EMPTY_ARRAY; } final PsiElement nameElement = call.getMethodExpression().getReferenceNameElement(); if (nameElement == null) return; holder.registerProblem(call, JavaBundle.message("inspection.slow.abstract.set.remove.all.description"), ProblemHighlightType.WARNING, nameElement.getTextRangeInParent(), fix); }