Set<PsiClass> (PsiElement context, PsiClass baseClass, Processor<? super PsiClass> inheritorsProcessor) { Set<PsiClass> visited = new HashSet<>(); context.getContainingFile().getOriginalFile().processDeclarations(new PsiScopeProcessor() { @Override public boolean execute(@NotNull PsiElement element, @NotNull ResolveState state) { if (element instanceof PsiClass && ((PsiClass)element).isInheritor(baseClass, true) && visited.add((PsiClass)element)) { return inheritorsProcessor.process((PsiClass)element); } return true; } }, ResolveState.initial(), null, context); return visited; }