boolean (@NotNull PsiModifierListOwner fieldOrClass) { final PsiModifierList modifierList = fieldOrClass.getModifierList(); if (modifierList == null) { return false; } Project project = fieldOrClass.getProject(); final PsiElementFactory factory = JavaPsiFacade.getElementFactory(project); final PsiAnnotation annotation = factory.createAnnotationFromText("@" + getAnnotationName(), fieldOrClass); JavaCodeStyleManager.getInstance(project).shortenClassReferences(annotation); modifierList.addAfter(annotation, null); return true; }