void (@NotNull ActionContext context, @NotNull PsiIdentifier element, @NotNull ModPsiUpdater updater) { final PsiElement holder = element.getParent(); PsiModifierListOwner createdElement = holder instanceof PsiField ? convertToMethod((PsiField)holder) : convertToField((PsiMethod)holder); final PsiModifierListOwner oldElement = (PsiModifierListOwner)holder; final PsiAnnotation psiAnnotation = AnnotationUtil.findAnnotation(oldElement, DATA_POINT_FQN, DATA_POINTS_FQN); assert psiAnnotation != null; final String annotation = psiAnnotation.getQualifiedName(); assert annotation != null; final PsiModifierList modifierList = createdElement.getModifierList(); assert modifierList != null; modifierList.addAnnotation(annotation); modifierList.setModifierProperty(PsiModifier.STATIC, true); modifierList.setModifierProperty(PsiModifier.PUBLIC, true); createdElement = (PsiModifierListOwner)oldElement.replace(createdElement); final PsiNameIdentifierOwner asNameIdOwner = (PsiNameIdentifierOwner)createdElement; updater.rename(asNameIdOwner, List.of(requireNonNull(asNameIdOwner.getName()))); }