void (@NotNull PsiMethodCallExpression methodCall, @NotNull PsiResolveHelper resolveHelper, @NotNull LanguageLevel languageLevel, @NotNull JavaSdkVersion javaSdkVersion, @NotNull PsiFile file, @NotNull Consumer<? super HighlightInfo.Builder> errorSink) { PsiExpressionList list = methodCall.getArgumentList(); PsiReferenceExpression referenceToMethod = methodCall.getMethodExpression(); JavaResolveResult[] results = referenceToMethod.multiResolve(true); JavaResolveResult resolveResult = results.length == 1 ? results[0] : JavaResolveResult.EMPTY; PsiElement resolved = resolveResult.getElement(); boolean isDummy = isDummyConstructorCall(methodCall, resolveHelper, list, referenceToMethod); if (isDummy) return; HighlightInfo.Builder builder; PsiSubstitutor substitutor = resolveResult.getSubstitutor(); if (resolved instanceof PsiMethod && resolveResult.isValidResult()) { builder = HighlightUtil.checkUnhandledExceptions(methodCall); if (builder == null && ((PsiMethod)resolved).hasModifierProperty(PsiModifier.STATIC)) { PsiClass containingClass = ((PsiMethod)resolved).getContainingClass(); if (containingClass != null && containingClass.isInterface()) { PsiElement element = ObjectUtils.notNull(referenceToMethod.getReferenceNameElement(), referenceToMethod); builder = HighlightUtil.checkFeature(element, HighlightingFeature.STATIC_INTERFACE_CALLS, languageLevel, file); if (builder == null) { builder = checkStaticInterfaceCallQualifier(referenceToMethod, resolveResult, methodCall, containingClass); } } } if (builder == null) { builder = GenericsHighlightUtil.checkInferredIntersections(substitutor, methodCall); } if (builder == null) { builder = checkVarargParameterErasureToBeAccessible((MethodCandidateInfo)resolveResult, methodCall); } if (builder == null) { builder = createIncompatibleTypeHighlightInfo(methodCall, resolveHelper, (MethodCandidateInfo)resolveResult, methodCall); } if (builder == null) { builder = checkInferredReturnTypeAccessible((MethodCandidateInfo)resolveResult, methodCall); } } else { MethodCandidateInfo candidateInfo = resolveResult instanceof MethodCandidateInfo ? (MethodCandidateInfo)resolveResult : null; PsiMethod resolvedMethod = candidateInfo != null ? candidateInfo.getElement() : null; if (!resolveResult.isAccessible() || !resolveResult.isStaticsScopeCorrect()) { builder = null; } else if (candidateInfo != null && !candidateInfo.isApplicable()) { if (candidateInfo.isTypeArgumentsApplicable()) { builder = createIncompatibleCallHighlightInfo(list, candidateInfo, errorSink); if (builder != null) { PsiType expectedTypeByParent = InferenceSession.getTargetTypeByParent(methodCall); PsiType actualType = ((PsiExpression)methodCall.copy()).getType(); TextRange fixRange = getFixRange(list); if (expectedTypeByParent != null && actualType != null && !expectedTypeByParent.isAssignableFrom(actualType)) { AdaptExpressionTypeFixUtil.registerExpectedTypeFixes(builder, fixRange, methodCall, expectedTypeByParent, actualType); } HighlightFixUtil.registerQualifyMethodCallFix(resolveHelper.getReferencedMethodCandidates(methodCall, false), methodCall, list, builder); registerMethodCallIntentions(builder, methodCall, list, resolveHelper); registerMethodReturnFixAction(builder, candidateInfo, methodCall); registerTargetTypeFixesBasedOnApplicabilityInference(methodCall, candidateInfo, resolvedMethod, builder); registerImplementsExtendsFix(builder, methodCall, resolvedMethod); errorSink.accept(builder); return; } } else { PsiReferenceParameterList typeArgumentList = methodCall.getTypeArgumentList(); PsiSubstitutor applicabilitySubstitutor = candidateInfo.getSubstitutor(false); if (typeArgumentList.getTypeArguments().length == 0 && resolvedMethod.hasTypeParameters()) { builder = GenericsHighlightUtil.checkInferredTypeArguments(resolvedMethod, methodCall, applicabilitySubstitutor); } else { builder = GenericsHighlightUtil.checkParameterizedReferenceTypeArguments(resolved, referenceToMethod, applicabilitySubstitutor, javaSdkVersion); } } } else { String description = JavaErrorBundle.message("method.call.expected"); builder = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(methodCall).descriptionAndTooltip(description); if (resolved instanceof PsiClass) { IntentionAction action = QuickFixFactory.getInstance().createInsertNewFix(methodCall, (PsiClass)resolved); builder.registerFix(action, null, null, null, null); } else { TextRange range = getFixRange(methodCall); registerStaticMethodQualifierFixes(methodCall, builder); registerUsageFixes(methodCall, builder, range); if (resolved instanceof PsiVariable && languageLevel.isAtLeast(LanguageLevel.JDK_1_8)) { PsiMethod method = LambdaUtil.getFunctionalInterfaceMethod(((PsiVariable)resolved).getType()); if (method != null) { IntentionAction action = QuickFixFactory.getInstance().createInsertMethodCallFix(methodCall, method); builder.registerFix(action, null, null, range, null); } } } } } if (builder == null) { builder = GenericsHighlightUtil.checkParameterizedReferenceTypeArguments(resolved, referenceToMethod, substitutor, javaSdkVersion); } if (builder != null) { errorSink.accept(builder); } }