code: private static Map<TypeVariable<?>, Type> getTypeArguments(Class<?> cls, final Class<?> toClass,
              final Map<TypeVariable<?>, Type> subtypeVarAssigns) {
          // make sure they're assignable
          if (!isAssignable(cls, toClass)) {
              return null;
          }
  
          // can't work with primitives
          if (cls.isPrimitive()) {
              // both classes are primitives?
              if (toClass.isPrimitive()) {
                  // dealing with widening here. No type arguments to be
                  // harvested with these two types.
                  return new HashMap<>();
              }
  
              // work with wrapper the wrapper class instead of the primitive
              cls = ClassUtils.primitiveToWrapper(cls);
          }
  
          // create a copy of the incoming map, or an empty one if it's null
          final HashMap<TypeVariable<?>, Type> typeVarAssigns = subtypeVarAssigns == null ? new HashMap<TypeVariable<?>, Type>()
                  : new HashMap<>(subtypeVarAssigns);
  
          // has target class been reached?
          if (toClass.equals(cls)) {
              return typeVarAssigns;
          }
  
          // walk the inheritance hierarchy until the target class is reached
          return getTypeArguments(getClosestParentType(cls, toClass), toClass, typeVarAssigns);
      }
docs: <p>Return a map of the type arguments of a class in the context of {@code toClass}.</p>
  
  @param cls the class in question
  @param toClass the context class
  @param subtypeVarAssigns a map with type variables
  @return the {@code Map} with type arguments