Collection<PsiClass> (@NotNull Module module, @NotNull String qualifiedName, boolean includeTests) { PsiClass annotationClass = JavaPsiFacade.getInstance(module.getProject()) .findClass(qualifiedName, moduleWithDependenciesAndLibrariesScope(module)); if (annotationClass == null || !annotationClass.isAnnotationType()) { return emptySet(); } PsiFile annotationFile = annotationClass.getContainingFile(); if (annotationFile == null) { return emptySet(); } if (ProjectScope.getLibrariesScope(module.getProject()).contains(annotationFile.getVirtualFile())) { Collection<PsiClass> libsTypes = getChildLibraryAnnotations(module, qualifiedName); return findAnnotationTypesWithChildren(libsTypes, getAnnotationSourceSearchScope(module, includeTests)); } else { // annotation defined in Project sources, there is no sense in search in libraries return findAnnotationTypesWithChildren(List.of(annotationClass), getAnnotationSourceSearchScope(module, includeTests)); } }