void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { if (!(element instanceof PsiReferenceList referenceList)) { return; } final PsiJavaCodeReferenceElement[] referenceElements = referenceList.getReferenceElements(); for (PsiJavaCodeReferenceElement referenceElement : referenceElements) { referenceElement.delete(); } final PsiElementFactory factory = JavaPsiFacade.getElementFactory( project); final GlobalSearchScope scope = referenceList.getResolveScope(); final PsiJavaCodeReferenceElement referenceElement = factory.createReferenceElementByFQClassName( CommonClassNames.JAVA_LANG_EXCEPTION, scope); referenceList.add(referenceElement); }