code: private static Map<TypeVariable<?>, Type> getTypeArguments(
              final ParameterizedType parameterizedType, final Class<?> toClass,
              final Map<TypeVariable<?>, Type> subtypeVarAssigns) {
          final Class<?> cls = getRawType(parameterizedType);
  
          // make sure they're assignable
          if (!isAssignable(cls, toClass)) {
              return null;
          }
  
          final Type ownerType = parameterizedType.getOwnerType();
          Map<TypeVariable<?>, Type> typeVarAssigns;
  
          if (ownerType instanceof ParameterizedType) {
              // get the owner type arguments first
              final ParameterizedType parameterizedOwnerType = (ParameterizedType) ownerType;
              typeVarAssigns = getTypeArguments(parameterizedOwnerType,
                      getRawType(parameterizedOwnerType), subtypeVarAssigns);
          } else {
              // no owner, prep the type variable assignments map
              typeVarAssigns = subtypeVarAssigns == null ? new HashMap<TypeVariable<?>, Type>()
                      : new HashMap<>(subtypeVarAssigns);
          }
  
          // get the subject parameterized type's arguments
          final Type[] typeArgs = parameterizedType.getActualTypeArguments();
          // and get the corresponding type variables from the raw class
          final TypeVariable<?>[] typeParams = cls.getTypeParameters();
  
          // map the arguments to their respective type variables
          for (int i = 0; i < typeParams.length; i++) {
              final Type typeArg = typeArgs[i];
              typeVarAssigns.put(typeParams[i], typeVarAssigns.containsKey(typeArg) ? typeVarAssigns
                      .get(typeArg) : typeArg);
          }
  
          if (toClass.equals(cls)) {
              // target class has been reached. Done.
              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 parameterized type in the context of {@code toClass}.</p>
  
  @param parameterizedType the parameterized type
  @param toClass           the class
  @param subtypeVarAssigns a map with type variables
  @return the {@code Map} with type arguments