PsiMethod (PsiAnonymousClass anonymousClass, String name) { final PsiMethod[] refMethods = anonymousClass.findMethodsByName(name, false); if (refMethods.length > 0) { final PsiClass baseClass = PsiUtil.resolveClassInType(anonymousClass.getBaseClassType()); if (baseClass != null && !hasCovariantOverridingOrNotPublic(baseClass, refMethods)) { for (PsiMethod method : refMethods) { if (method.findSuperMethods(baseClass).length > 0) { return method; } } } } return null; }