@NotNull
  public static @NlsSafe String formatClass(@NotNull PsiClass aClass, @FormatClassOptions int options) {
    StringBuilder buffer = new StringBuilder();

    if (BitUtil.isSet(options, SHOW_MODIFIERS) && !BitUtil.isSet(options, MODIFIERS_AFTER)) {
      formatModifiers(aClass, options,buffer);
    }

    if (BitUtil.isSet(options, SHOW_NAME)) {
      if (aClass instanceof PsiAnonymousClass && BitUtil.isSet(options, SHOW_ANONYMOUS_CLASS_VERBOSE)) {
        PsiClassType baseClassReference = ((PsiAnonymousClass)aClass).getBaseClassType();
        PsiClass baseClass = baseClassReference.resolve();
        String name = baseClass == null ? baseClassReference.getPresentableText() : formatClass(baseClass, options);
        buffer.append(JavaPsiBundle.message("anonymous.class.derived.display", name));
      }
      else {
        String name = aClass instanceof PsiImplicitClass ? aClass.getQualifiedName() : aClass.getName();
        if (name != null) {
          appendSpaceIfNeeded(buffer);
          if (BitUtil.isSet(options, SHOW_FQ_NAME)) {
            String qName = aClass.getQualifiedName();
            if (qName != null) {
              buffer.append(qName);
            }
            else {
              buffer.append(aClass.getName());
            }
          }
          else {
            buffer.append(aClass.getName());
          }
        }
      }
    }

    if (BitUtil.isSet(options, SHOW_MODIFIERS) && BitUtil.isSet(options, MODIFIERS_AFTER)) {
      formatModifiers(aClass, options,buffer);
    }

    if (BitUtil.isSet(options, SHOW_EXTENDS_IMPLEMENTS)) {
      PsiReferenceList extendsList = aClass.getExtendsList();
      if (extendsList != null) {
        String extendsText = formatReferenceList(extendsList, options);
        if (!extendsText.isEmpty()) {
          appendSpaceIfNeeded(buffer);
          buffer.append("extends ").append(extendsText);
        }
      }

      PsiReferenceList implementsList = aClass.getImplementsList();
      if (implementsList != null) {
        String implementsText = formatReferenceList(implementsList, options);
        if (!implementsText.isEmpty()) {
          appendSpaceIfNeeded(buffer);
          buffer.append("implements ").append(implementsText);
        }
      }
    }

    return buffer.toString();
  }
@NotNull
  public static @NlsSafe String formatClass(@NotNull PsiClass aClass, @FormatClassOptions int options)