void (JavaResolveResult[] candidates, PsiExpression[] expressions, @NotNull HighlightInfo.Builder highlightInfo, TextRange fixRange) { PsiType expectedType = null; PsiExpression expr = null; nextMethod: for (int i = 0; i < candidates.length && expectedType == null; i++) { final JavaResolveResult candidate = candidates[i]; final PsiSubstitutor substitutor = candidate.getSubstitutor(); final PsiElement element = candidate.getElement(); assert element != null; final PsiMethod method = (PsiMethod)element; final PsiParameter[] parameters = method.getParameterList().getParameters(); if (!method.isVarArgs() && parameters.length != expressions.length) continue; for (int j = 0; j < expressions.length; j++) { PsiExpression expression = expressions[j]; final PsiType exprType = expression.getType(); if (exprType != null && !PsiTypes.nullType().equals(exprType)) { PsiType paramType = parameters[Math.min(j, parameters.length - 1)].getType(); if (paramType instanceof PsiEllipsisType) { paramType = ((PsiEllipsisType)paramType).getComponentType(); } paramType = substitutor.substitute(paramType); if (paramType.isAssignableFrom(exprType)) continue; final PsiClassType classType = getClassType(paramType, expression); if (expectedType == null && classType != null && findWrapper(exprType, classType, paramType instanceof PsiPrimitiveType, expression) != null) { expectedType = paramType; expr = expression; } else { expectedType = null; expr = null; continue nextMethod; } } } } if (expectedType != null) { var action = new WrapExpressionFix(expectedType, expr, null); highlightInfo.registerFix(action, null, null, fixRange, null); } }