void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { final PsiAnnotation annotation = PsiTreeUtil.getParentOfType(element, PsiAnnotation.class); if (annotation == null) { return; } final PsiElementFactory factory = JavaPsiFacade.getElementFactory(project); CommentTracker tracker = new CommentTracker(); final String annotationText = buildAnnotationText(annotation, tracker); final PsiAnnotation newAnnotation = factory.createAnnotationFromText(annotationText, element); tracker.replaceAndRestoreComments(annotation, newAnnotation); }