void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { final PsiElement parent = element.getParent(); if (!(parent instanceof PsiClass aClass)) { return; } final PsiReferenceList extendsList = aClass.getExtendsList(); if (extendsList == null) { return; } final JavaPsiFacade facade = JavaPsiFacade.getInstance(project); final PsiElementFactory factory = facade.getElementFactory(); final GlobalSearchScope scope = aClass.getResolveScope(); final PsiJavaCodeReferenceElement reference = factory.createReferenceElementByFQClassName(CommonClassNames.JAVA_LANG_EXCEPTION, scope); CommentTracker tracker = new CommentTracker(); final PsiJavaCodeReferenceElement[] referenceElements = extendsList.getReferenceElements(); for (PsiJavaCodeReferenceElement referenceElement : referenceElements) { tracker.delete(referenceElement); } tracker.insertCommentsBefore(extendsList.add(reference)); }