void (@NotNull final PsiElement element, @NotNull final String newName, @NotNull final Map<PsiElement, String> allRenames) { if (element instanceof PsiRecordComponent component) { PsiClass containingClass = component.getContainingClass(); if (containingClass != null) { String name = component.getName(); addGetter(element, newName, allRenames, containingClass, name); PsiMethod canonicalConstructor = ContainerUtil.find(containingClass.getConstructors(), c -> JavaPsiRecordUtil.isExplicitCanonicalConstructor(c)); if (canonicalConstructor != null) { PsiParameter parameter = ContainerUtil.find(canonicalConstructor.getParameterList().getParameters(), p -> name.equals(p.getName())); if (parameter != null) { allRenames.put(parameter, newName); } } } } if (element instanceof PsiParameter) { PsiMethod method = PsiTreeUtil.getParentOfType(element.getParent(), PsiMethod.class); if (method == null) return; if (JavaPsiRecordUtil.isExplicitCanonicalConstructor(method)) { PsiRecordComponent recordComponent = JavaPsiRecordUtil.getComponentForCanonicalConstructorParameter((PsiParameter)element); allRenames.put(recordComponent, newName); PsiClass containingClass = method.getContainingClass(); if (containingClass != null) { addGetter(element, newName, allRenames, containingClass, ((PsiParameter)element).getName()); } } } }