code: @SuppressWarnings("PMD.UseStringBufferForStringAppends")
      private static String processClass(final Class clazz) {
          String res;
          // simpleName on anonymous class is empty string
          if (clazz.isAnonymousClass()) {
              res = clazz.getEnclosingClass().getSimpleName();
              try {
                  if (clazz.getEnclosingConstructor() != null) {
                      res += HASH + toStringConstructor(clazz.getEnclosingConstructor(), IgnoreGenericsMap.getInstance());
                  } else if (clazz.getEnclosingMethod() != null) {
                      res += HASH + toStringMethod(clazz.getEnclosingMethod(), IgnoreGenericsMap.getInstance());
                  }
              } catch (Throwable ignored) {
                  // ignore possible "enclosing method not found" in groovy
              }
              res += "$" + (clazz.getSuperclass() == Object.class && clazz.getInterfaces().length > 0
                      ? clazz.getInterfaces()[0].getSimpleName() : clazz.getSuperclass().getSimpleName());
          } else {
              res = clazz.getSimpleName();
          }
          return res;
      }
docs: For usual classes {@link Class#getSimpleName()} returned. For anonymous classes returning
  "EnclosingClass#(constructor|method)$type", where EnclosingClass is a class where anonymous class was
  declared, (constructor|method) is method or constructor signature where anonymous class declared
  (not present if anonymous class declared in class field) and type is direct super type of anonymous class.
  <p>
  For example, for
  <pre>{@code
  class Something {
  private Inner in1 = new Inner() {...};
  
  void method() {
  Inner in2 = new Inner() {...}
  }
  }
  }</pre>
  to string for in1 will be "Something$Inner" and for in2 "Something#void method()$Inner.
  <p>
  Note that in java {@code getName()} for such classes would be like "com.mycompany.Something$1", which does
  not shows all possible type information ({@code getSimpleName()} on anonymous class is empty string!).
  <p>
  In groovy, enclosing methods and constructors can't be resolved and so would not be included. Most certainly,
  for groovy type (anonymous class created in groovy code, not in java), GroovyObject will appear instead of
  Object (because every object in groovy implements GroovyObject).
  
  @param clazz class
  @return to string class representation