code: @NullSafe
    public static Class<?> toRawType(Type type) {
  
      Type resolvedType = type instanceof ParameterizedType ? ((ParameterizedType) type).getRawType()
        : type instanceof TypeVariable ? safeGetValue(() -> loadClass(((TypeVariable) type).getName()), Object.class)
        : type;
  
      return Class.class.cast(Optional.ofNullable(resolvedType)
        .filter(it -> it instanceof Class)
        .orElseThrow(() -> newIllegalArgumentException("[%1$s] is not resolvable as a %2$s",
          type, Class.class.getName())));
    }
docs: Resolves the {@link Class} type of {@link Type}.
  
  @param type {@link Type} to resolve as a {@link Class}.
  @return the resolved {@link Class} type {@link Type}.
  @throws IllegalArgumentException if the given {@link Type} cannot be resolved as a {@link Class} type.
  @see java.lang.reflect.ParameterizedType
  @see java.lang.reflect.Type