PsiMethod (PsiVariable[] parameters, @NotNull PsiMethod psiMethod) { String methodName = psiMethod.getName(); PsiClass containingClass = psiMethod.getContainingClass(); if (containingClass == null) return null; final PsiMethod[] psiMethods = containingClass.findMethodsByName(methodName, false); if (psiMethods.length == 1) return psiMethod; final PsiType receiverType = parameters[0].getType(); for (PsiMethod method : psiMethods) { if (isPairedNoReceiver(parameters, receiverType, method)) { final PsiMethod[] deepestSuperMethods = psiMethod.findDeepestSuperMethods(); for (PsiMethod superMethod : deepestSuperMethods) { PsiMethod validSuperMethod = getNonAmbiguousReceiver(parameters, superMethod); if (validSuperMethod != null) return validSuperMethod; } return null; } } return psiMethod; }