void (PsiReferenceList referenceList, PsiClass containingClass) { if (referenceList == null) { return; } final PsiJavaCodeReferenceElement[] elements = referenceList.getReferenceElements(); for (final PsiJavaCodeReferenceElement element : elements) { final PsiElement referent = element.resolve(); if (!(referent instanceof PsiClass psiClass)) { continue; } if (psiClass.isAnnotationType()) { registerError(element, containingClass); } } }