void (@NotNull Project project, @NotNull PsiElement psiElement, @NotNull ModPsiUpdater updater) { if (!(psiElement instanceof PsiIdentifier)) return; PsiModifierListOwner owner = (PsiModifierListOwner)psiElement.getParent(); if (owner instanceof PsiClass rec) { if (!rec.isRecord()) return; String compactCtorText = "public " + rec.getName() + " {}"; PsiMethod ctor = JavaPsiFacade.getElementFactory(project).createMethodFromText(compactCtorText, owner); PsiMethod firstMethod = ArrayUtil.getFirstElement(rec.getMethods()); owner = (PsiMethod)rec.addBefore(ctor, firstMethod); } if (owner instanceof PsiMethod) { PsiModifierList list = owner.getModifierList(); if (myFinal) { list.setModifierProperty(PsiModifier.FINAL, true); } list.addAnnotation(CommonClassNames.JAVA_LANG_SAFE_VARARGS); } }