Collection<PsiClass> (@NotNull PsiClass psiClass, @NotNull SearchScope searchScope) { if (psiClass.isAnnotationType()) { Set<PsiClass> result = new HashSet<>(); AnnotatedElementsSearch.searchPsiClasses(psiClass, searchScope).forEach(processorResult -> { if (processorResult.isAnnotationType()) { result.add(processorResult); } return true; }); return result; } return ClassInheritorsSearch.search(psiClass, searchScope, false).findAll(); }