boolean (@NotNull HighlightInfo.Builder info, PsiCall callExpression, final CandidateInfo[] candidates, final TextRange fixRange) { PsiExpression[] expressions = Objects.requireNonNull(callExpression.getArgumentList()).getExpressions(); if (expressions.length < 2) return false; List<PsiCall> permutations = new ArrayList<>(); for (CandidateInfo candidate : candidates) { if (candidate instanceof MethodCandidateInfo methodCandidate) { PsiMethod method = methodCandidate.getElement(); PsiSubstitutor substitutor = methodCandidate.getSubstitutor(); PsiParameter[] parameters = method.getParameterList().getParameters(); if (expressions.length != parameters.length) continue; int minIncompatibleIndex = parameters.length; int maxIncompatibleIndex = 0; int incompatibilitiesCount = 0; for (int i = 0; i < parameters.length; i++) { PsiParameter parameter = parameters[i]; PsiType type = substitutor.substitute(parameter.getType()); if (TypeConversionUtil.areTypesAssignmentCompatible(type, expressions[i])) continue; if (minIncompatibleIndex == parameters.length) minIncompatibleIndex = i; maxIncompatibleIndex = i; incompatibilitiesCount++; } try { PsiExpression[] clonedExpressions = expressions.clone(); registerSwapFixes(clonedExpressions, callExpression, permutations, methodCandidate, incompatibilitiesCount, minIncompatibleIndex, maxIncompatibleIndex); registerShiftFixes(clonedExpressions, callExpression, permutations, methodCandidate, minIncompatibleIndex, maxIncompatibleIndex); } catch (IncorrectOperationException e) { LOG.error(e); } } } if (permutations.size() == 1) { PermuteArgumentsFix fix = new PermuteArgumentsFix(callExpression, permutations.get(0)); info.registerFix(fix, null, null, fixRange, null); return true; } return false; }