public static ClassElement newClassElement(PsiClass clazz) {
    ClassElement ce = new ClassElement();

    // name
    if (clazz instanceof PsiImplicitClass) {
      ce.setName(clazz.getQualifiedName());
    }
    else if (clazz instanceof PsiAnonymousClass anonymousClass) {
      String name = anonymousClass.getBaseClassReference().getReferenceName();
      ce.setName(getAnonymousClassName(name));
    }
    else {
      ce.setName(clazz.getName());
    }
    ce.setQualifiedName(clazz.getQualifiedName());


    // super
    PsiClass superClass = clazz.getSuperClass();
    if (superClass != null && !CommonClassNames.JAVA_LANG_OBJECT.equals(superClass.getQualifiedName())) {
      ce.setSuperName(superClass.getName());
    }

    // interfaces
    ce.setImplementNames(PsiAdapter.getImplementsClassnames(clazz));

    // other
    ce.setEnum(clazz.isEnum());
    ce.setDeprecated(clazz.isDeprecated());
    ce.setException(PsiAdapter.isExceptionClass(clazz));
    ce.setAbstract(clazz.hasModifierProperty(PsiModifier.ABSTRACT));
    ce.setTypeParams(clazz.getTypeParameters().length);

    return ce;
  }
public static ClassElement newClassElement(PsiClass clazz)