PsiMethod (PsiMethod baseMethod, @NotNull PsiClass aClass, boolean checkBases) { if (baseMethod == null) return null; // base method is invalid if (cannotBeOverridding(baseMethod)) return null; PsiMethod subMethod = MethodSignatureUtil.findMethodBySuperMethod(aClass, baseMethod, checkBases); if (subMethod != null) return subMethod; PsiMethod[] methods = baseMethod.findSuperMethods(aClass); for (PsiMethod method : methods) { if (checkBases || method.getContainingClass() == aClass) { return method; } } return null; }