boolean (@NotNull PsiMethod method, @NotNull PsiClass baseClass) { // previous implementation: // final Query<PsiMethod> search = OverridingMethodsSearch.search(method); //for (PsiMethod overridingMethod : search) { // final PsiClass aClass = overridingMethod.getContainingClass(); // if (InheritanceUtil.isCorrectDescendant(aClass, baseClass, true)) { // return true; // } //} // was extremely slow and used an enormous amount of memory for clone() if (!PsiUtil.canBeOverridden(method) || baseClass instanceof PsiAnonymousClass || baseClass.hasModifierProperty(PsiModifier.FINAL)) { return false; } final Query<PsiClass> search = ClassInheritorsSearch.search(baseClass, baseClass.getUseScope(), true, true, true); for (PsiClass inheritor : search) { final PsiMethod overridingMethod = inheritor.findMethodBySignature(method, false); if (overridingMethod != null) { return true; } } return false; }