PsiAnnotation (PsiClass aClass, String annotation, Set<? super PsiClass> visited) { PsiAnnotation directAnnotation = AnnotationUtil.findAnnotation(aClass, true, annotation); if (directAnnotation != null) { return directAnnotation; } List<PsiClass> resolvedAnnotations = getResolvedClassesInAnnotationsList(aClass); for (PsiClass resolvedAnnotation : resolvedAnnotations) { if (visited.add(resolvedAnnotation)) { PsiAnnotation annotated = findMetaAnnotation(resolvedAnnotation, annotation, visited); if (annotated != null) { return annotated; } } } return null; }