boolean (@NotNull LocalSearchScope searchScope, @NotNull PsiMethod method, @NotNull Project project, @NotNull final Processor<? super PsiMethod> consumer) { // optimisation: in case of local scope it's considered cheaper to enumerate all scope files and check if there is an inheritor there, // instead of traversing the (potentially huge) class hierarchy and filter out almost everything by scope. VirtualFile[] virtualFiles = searchScope.getVirtualFiles(); final PsiClass methodContainingClass = ReadAction.compute(method::getContainingClass); if (methodContainingClass == null) return true; final boolean[] success = {true}; for (VirtualFile virtualFile : virtualFiles) { ProgressManager.checkCanceled(); ApplicationManager.getApplication().runReadAction(new Runnable() { @Override public void run() { PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile); if (psiFile != null) { psiFile.accept(new JavaRecursiveElementWalkingVisitor() { @Override public void visitClass(@NotNull PsiClass candidate) { ProgressManager.checkCanceled(); PsiMethod overridingMethod = candidate.isInheritor(methodContainingClass, true) ? findOverridingMethod(candidate, method, methodContainingClass) : null; if (overridingMethod != null && !consumer.process(overridingMethod)) { success[0] = false; stopWalking(); } else { super.visitClass(candidate); } } }); } } }); } return success[0]; }