PsiAnnotation (@NotNull GrAnnotation annotation) { if (!mayHaveAnnotationCollector(annotation)) { return null; } PsiElement resolved = annotation.getClassReference().resolve(); if (resolved instanceof ClsClassImpl) { return findAnnotationCollector(((ClsClassImpl)resolved).getSourceMirrorClass()); } else if (resolved instanceof PsiClass) { return findAnnotationCollector((PsiClass)resolved); } else { return null; } }