boolean (@NotNull final DirectClassInheritorsSearch.SearchParameters queryParameters, @NotNull final Processor<? super PsiClass> consumer) { final PsiClass clazz = queryParameters.getClassToProcess(); SearchScope scope = ReadAction.compute(() -> queryParameters.getScope().intersectWith(clazz.getUseScope())); Project project = PsiUtilCore.getProjectInReadAction(clazz); GlobalSearchScope globalSearchScope = GlobalSearchScopeUtil.toGlobalSearchScope(scope, project); DumbService dumbService = DumbService.getInstance(project); List<PsiClass> candidates = dumbService.runReadActionInSmartMode(() -> { if (!clazz.isValid()) return Collections.emptyList(); return getDerivingClassCandidates(clazz, globalSearchScope, queryParameters.includeAnonymous()); }); if (!candidates.isEmpty()) { RelaxedDirectInheritorChecker checker = dumbService.runReadActionInSmartMode(() -> new RelaxedDirectInheritorChecker(clazz)); for (PsiClass candidate : candidates) { if (!queryParameters.isCheckInheritance() || dumbService.runReadActionInSmartMode(() -> checker.checkInheritance(candidate))) { if (!consumer.process(candidate)) { return false; } } } } return true; }