PsiAnnotation (PsiAnnotationOwner annotationOwner, String fqn) { if (annotationOwner instanceof PsiModifierList modifierList) { Project project = modifierList.getProject(); PsiAnnotation annotation = PsiElementFactory.getInstance(project).createAnnotationFromText("@" + fqn + "()", modifierList); return (PsiAnnotation)modifierList.addBefore(annotation, modifierList.getFirstChild()); } return null; }