code: private static Type substituteTypeVariables(final Type type, final Map<TypeVariable<?>, Type> typeVarAssigns) {
          if (type instanceof TypeVariable<?> && typeVarAssigns != null) {
              final Type replacementType = typeVarAssigns.get(type);
  
              if (replacementType == null) {
                  throw new IllegalArgumentException("missing assignment type for type variable "
                          + type);
              }
              return replacementType;
          }
          return type;
      }
docs: <p>Find the mapping for {@code type} in {@code typeVarAssigns}.</p>
  
  @param type           the type to be replaced
  @param typeVarAssigns the map with type variables
  @return the replaced type
  @throws IllegalArgumentException if the type cannot be substituted