void (@NotNull HighlightInfo.Builder highlightInfo, @NotNull MethodCandidateInfo candidate, @NotNull PsiCall methodCall) { if (candidate.getInferenceErrorMessage() != null && methodCall.getParent() instanceof PsiReturnStatement) { PsiMethod containerMethod = PsiTreeUtil.getParentOfType(methodCall, PsiMethod.class, true, PsiLambdaExpression.class); if (containerMethod != null) { PsiMethod method = candidate.getElement(); PsiExpression methodCallCopy = JavaPsiFacade.getElementFactory(method.getProject()).createExpressionFromText(methodCall.getText(), methodCall); PsiType methodCallTypeByArgs = methodCallCopy.getType(); //ensure type params are not included methodCallTypeByArgs = JavaPsiFacade.getElementFactory(method.getProject()) .createRawSubstitutor(method).substitute(methodCallTypeByArgs); if (methodCallTypeByArgs != null) { @Nullable TextRange fixRange = getFixRange(methodCall); IntentionAction action = QuickFixFactory.getInstance().createMethodReturnFix(containerMethod, methodCallTypeByArgs, true); highlightInfo.registerFix(action, null, null, fixRange, null); } } } }