docs: private static boolean isAccessible(final Class<?> type) {
          Class<?> cls = type;
          while (cls != null) {
              if (!Modifier.isPublic(cls.getModifiers())) {
                  return false;
              }
              cls = cls.getEnclosingClass();
          }
          return true;
      }