boolean (@NotNull HighlightInfo.Builder info, PsiCallExpression callExpression, final CandidateInfo[] candidates, TextRange fixRange) { PsiExpressionList parent = ObjectUtils.tryCast(callExpression.getParent(), PsiExpressionList.class); if (parent == null) return false; PsiCallExpression parentCall = ObjectUtils.tryCast(parent.getParent(), PsiCallExpression.class); if (parentCall == null) return false; PsiExpressionList argList = callExpression.getArgumentList(); if (argList == null) return false; PsiExpression[] args = argList.getExpressions(); if (args.length == 0) return false; PsiExpression[] parentArgs = parent.getExpressions(); int pos = ArrayUtil.indexOf(parentArgs, callExpression); if (pos == -1) return false; IntSet shifts = new IntOpenHashSet(); for (CandidateInfo candidate : candidates) { PsiMethod candidateMethod = ObjectUtils.tryCast(candidate.getElement(), PsiMethod.class); if (candidateMethod == null || candidateMethod.isVarArgs()) return false; int count = candidateMethod.getParameterList().getParametersCount(); if (count == 0 || count == args.length) return false; shifts.add(args.length - count); } if (shifts.isEmpty()) return false; MoveParenthesisFix fix = null; for (int shift : shifts) { PsiCallExpression copy = copyWithShift(parentCall, pos, shift); if (copy == null) continue; JavaResolveResult parentResolve = copy.resolveMethodGenerics(); if (!parentResolve.isValidResult()) continue; var childCopy = (PsiCallExpression)Objects.requireNonNull(copy.getArgumentList()).getExpressions()[pos]; JavaResolveResult childResolve = childCopy.resolveMethodGenerics(); if (!childResolve.isValidResult()) continue; if (fix != null) return false; fix = new MoveParenthesisFix(parentCall, pos, shift); } if (fix == null) return false; info.registerFix(fix, null, null, fixRange, null); return true; }