Boolean (@NotNull CandidateInfo conflict, PsiType @NotNull [] functionalInterfaceParamTypes, boolean hasReceiver, @NotNull PsiMethodReferenceExpression referenceExpression, boolean functionalMethodVarArgs, PsiMethod interfaceMethod) { PsiMethod psiMethod = ((MethodCandidateInfo)conflict).getElement(); PsiSubstitutor substitutor = ((MethodCandidateInfo)conflict).getSubstitutor(false); if (((MethodCandidateInfo)conflict).getInferenceErrorMessage() != null) return null; PsiType[] parameterTypes = psiMethod.getSignature(substitutor).getParameterTypes(); boolean varargs = ((MethodCandidateInfo)conflict).isVarargs(); if (varargs && (!psiMethod.isVarArgs() || functionalMethodVarArgs)) { return null; } //prefer statically correct search variant when a vararg method is applicable both as first and second search if (hasReceiver && varargs && isCorrectAssignment(parameterTypes, functionalInterfaceParamTypes, interfaceMethod, true, conflict, 0) && isCorrectAssignment(parameterTypes, functionalInterfaceParamTypes, interfaceMethod, true, conflict, 1)) { return psiMethod.hasModifierProperty(PsiModifier.STATIC); } if ((varargs || functionalInterfaceParamTypes.length == parameterTypes.length) && isCorrectAssignment(parameterTypes, functionalInterfaceParamTypes, interfaceMethod, varargs, conflict, 0)) { //reject static interface methods called on something else but interface class if (psiMethod.hasModifierProperty(PsiModifier.STATIC)) { PsiClass containingClass = psiMethod.getContainingClass(); if (containingClass != null && containingClass.isInterface()) { PsiClass qualifierClass = PsiMethodReferenceUtil.getQualifierResolveResult(referenceExpression).getContainingClass(); if (!containingClass.getManager().areElementsEquivalent(qualifierClass, containingClass)) { return null; } } } return true; } if (hasReceiver && (varargs || functionalInterfaceParamTypes.length == parameterTypes.length + 1) && isCorrectAssignment(parameterTypes, functionalInterfaceParamTypes, interfaceMethod, varargs, conflict, 1)) { return false; } return null; }