docs: public static ClassNode getNextSuperClass(ClassNode clazz, ClassNode goalClazz) {
          if (clazz.isArray()) {
              if (!goalClazz.isArray()) return null;
              ClassNode cn = getNextSuperClass(clazz.getComponentType(), goalClazz.getComponentType());
              if (cn != null) cn = cn.makeArray();
              return cn;
          }
  
          if (!goalClazz.isInterface()) {
              if (clazz.isInterface()) {
                  if (OBJECT_TYPE.equals(clazz)) return null;
                  return OBJECT_TYPE;
              } else {
                  return clazz.getUnresolvedSuperClass();
              }
          }
  
          ClassNode[] interfaces = clazz.getUnresolvedInterfaces();
          for (ClassNode anInterface : interfaces) {
              if (StaticTypeCheckingSupport.implementsInterfaceOrIsSubclassOf(anInterface, goalClazz)) {
                  return anInterface;
              }
          }
          //none of the interfaces here match, so continue with super class
          return clazz.getUnresolvedSuperClass();
      }