private static void transform(PsiClass replacementClass, ClassType type) {
    final PsiIdentifier nameIdentifier = replacementClass.getNameIdentifier();
    if (nameIdentifier == null) {
      return;
    }
    final PsiKeyword classKeyword = PsiTreeUtil.getPrevSiblingOfType(nameIdentifier, PsiKeyword.class);
    if (classKeyword == null) {
      return;
    }
    final PsiElementFactory factory = JavaPsiFacade.getElementFactory(replacementClass.getProject());
    final PsiClass aClass = switch (type) {
      case ANNOTATION -> factory.createAnnotationType("X");
      case ENUM -> factory.createEnum("X");
      case INTERFACE -> factory.createInterface("X");
      case RECORD -> factory.createRecord("X");
    };
    final PsiIdentifier identifier = aClass.getNameIdentifier();
    final PsiKeyword newKeyword = PsiTreeUtil.getPrevSiblingOfType(identifier, PsiKeyword.class);
    assert newKeyword != null;
    final PsiElement replacement = classKeyword.replace(newKeyword);
    final PsiElement atToken = newKeyword.getPrevSibling();
    if (atToken != null) {
      replacementClass.addBefore(atToken, replacement);
    }
  }
private static void transform(PsiClass replacementClass, ClassType type)