PsiElement () { PsiClass clsClass = getContainingClass(); if (clsClass != null) { PsiClass psiClass = ObjectUtils.tryCast(clsClass.getNavigationElement(), PsiClass.class); if (psiClass != null && psiClass != clsClass) { PsiRecordComponent[] clsComponents = clsClass.getRecordComponents(); int index = ArrayUtil.indexOf(clsComponents, this); if (index >= 0) { PsiRecordComponent[] psiComponents = psiClass.getRecordComponents(); if (psiComponents.length == clsComponents.length) { return psiComponents[index]; } } } } return this; }