docs: private static Class<?> getRawClass(Type type) {
      if (type instanceof Class) {
        return (Class<?>) type;
      }
      if (type instanceof ParameterizedType) {
        return getRawClass(((ParameterizedType) type).getRawType());
      }
      // For TypeVariable and WildcardType, returns the first upper bound.
      if (type instanceof TypeVariable) {
        return getRawClass(((TypeVariable) type).getBounds()[0]);
      }
      if (type instanceof WildcardType) {
        return getRawClass(((WildcardType) type).getUpperBounds()[0]);
      }
      if (type instanceof GenericArrayType) {
        Class<?> componentClass = getRawClass(((GenericArrayType) type).getGenericComponentType());
        return Array.newInstance(componentClass, 0).getClass();
      }
      // This shouldn't happen as we captured all implementations of Type above (as or Java 8)
      throw new IllegalArgumentException("Unsupported type " + type + " of type class " + type.getClass());
    }