void (@NotNull final Project project, @NotNull final ClassInheritorsSearch.SearchParameters parameters, @NotNull LocalSearchScope searchScope, @NotNull PsiClass baseClass, @NotNull Processor<? super PsiClass> 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 boolean[] success = {true}; if (virtualFiles.length == 0) { for (PsiElement element : searchScope.getScope()) { processFile(element.getContainingFile(), consumer, parameters, baseClass, success); } } for (VirtualFile virtualFile : virtualFiles) { ProgressManager.checkCanceled(); ApplicationManager.getApplication().runReadAction(() -> { PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile); if (psiFile != null) { processFile(psiFile, consumer, parameters, baseClass, success); } }); } }