boolean (@NotNull PsiModifierListOwner modifierListOwner, @NotNull String shortAnnotationName) { PsiModifierList list = modifierListOwner.getModifierList(); if (list != null) { for (PsiAnnotation annotation : list.getAnnotations()) { PsiJavaCodeReferenceElement ref = annotation.getNameReferenceElement(); if (ref != null && shortAnnotationName.equals(ref.getReferenceName())) { return true; } } } return false; }