public static JavaElementKind fromElement(@NotNull PsiElement element) {
    if (element instanceof PsiClass) {
      PsiClass psiClass = (PsiClass)element;
      if (psiClass instanceof PsiAnonymousClass) {
        return ANONYMOUS_CLASS;
      }
      if (psiClass.isEnum()) {
        return ENUM;
      }
      if (psiClass.isRecord()) {
        return RECORD;
      }
      if (psiClass.isAnnotationType()) {
        return ANNOTATION;
      }
      if (psiClass.isInterface()) {
        return INTERFACE;
      }
      if (psiClass instanceof PsiTypeParameter) {
        return TYPE_PARAMETER;
      }
      return CLASS;
    }
    if (element instanceof PsiMethod) {
      if (((PsiMethod)element).isConstructor()) {
        return CONSTRUCTOR;
      }
      if (((PsiMethod)element).hasModifierProperty(PsiModifier.ABSTRACT)) {
        return ABSTRACT_METHOD;
      }
      return METHOD;
    }
    if (element instanceof PsiField) {
      PsiField field = (PsiField)element;
      if (field instanceof PsiEnumConstant) {
        return ENUM_CONSTANT;
      }
      if (field.hasModifierProperty(PsiModifier.STATIC) && field.hasModifierProperty(PsiModifier.FINAL)) {
        return CONSTANT;
      }
      return FIELD;
    }
    if (element instanceof PsiTypeParameterList) {
      return TYPE_PARAMETERS;
    }
    if (element instanceof PsiReferenceParameterList) {
      return TYPE_ARGUMENTS;
    }
    if (element instanceof PsiReferenceList) {
      PsiReferenceList.Role role = ((PsiReferenceList)element).getRole();
      if (role == PsiReferenceList.Role.THROWS_LIST) {
        return THROWS_LIST;
      }
      else if (role == PsiReferenceList.Role.EXTENDS_LIST) {
        return EXTENDS_LIST;
      }
      else if (role == PsiReferenceList.Role.PERMITS_LIST) {
        return PERMITS_LIST;
      }
    }
    if (element instanceof PsiAnnotation) {
      return ANNOTATION;
    }
    if (element instanceof PsiRecordComponent) {
      return RECORD_COMPONENT;
    }
    if (element instanceof PsiLocalVariable) {
      return LOCAL_VARIABLE;
    }
    if (element instanceof PsiPatternVariable) {
      return PATTERN_VARIABLE;
    }
    if (element instanceof PsiParameter) {
      return PARAMETER;
    }
    if (element instanceof PsiReceiverParameter) {
      return RECEIVER_PARAMETER;
    }
    if (element instanceof PsiVariable) {
      return VARIABLE;
    }
    if (element instanceof PsiPackage) {
      return PACKAGE;
    }
    if (element instanceof PsiPackageStatement) {
      return PACKAGE_STATEMENT;
    }
    if (element instanceof PsiJavaModule) {
      return MODULE;
    }
    if (element instanceof PsiClassInitializer) {
      return INITIALIZER;
    }
    if (element instanceof PsiLabeledStatement) {
      return LABEL;
    }
    if (element instanceof PsiStatement) {
      return STATEMENT;
    }
    if (element instanceof PsiMethodCallExpression) {
      return METHOD_CALL;
    }
    if (element instanceof PsiExpression) {
      return EXPRESSION;
    }
    if (element instanceof PsiSnippetDocTagBody) {
      return SNIPPET_BODY;
    }
    if (PsiUtil.isJavaToken(element, JavaTokenType.SEMICOLON)) {
      return SEMICOLON;
    }
    return UNKNOWN;
  }
public static JavaElementKind fromElement(@NotNull PsiElement element)