void (@NotNull ClassesWithAnnotatedMembersSearch.Parameters queryParameters, @NotNull final Processor<? super PsiClass> consumer) { SearchScope scope = queryParameters.getScope(); for (QueryExecutor<PsiClass, ClassesWithAnnotatedMembersSearch.Parameters> executor : ClassesWithAnnotatedMembersSearch.EP_NAME.getExtensionList()) { if (executor instanceof ScopedQueryExecutor) { scope = scope.intersectWith(GlobalSearchScope.notScope(((ScopedQueryExecutor) executor).getScope(queryParameters))); } } final Set<PsiClass> processed = new HashSet<>(); AnnotatedElementsSearch.searchPsiMembers(queryParameters.getAnnotationClass(), scope).forEach(member -> { PsiClass psiClass = ReadAction.compute(() -> member instanceof PsiClass ? (PsiClass)member : member.getContainingClass()); if (psiClass != null && processed.add(psiClass)) { consumer.process(psiClass); } return true; }); }