code: public static Type resolveType(Type targetType, Type rootType)
      {
          Type resolvedType;
  
          if (targetType instanceof ParameterizedType && rootType instanceof ParameterizedType) {
              ParameterizedType parameterizedType = (ParameterizedType) targetType;
  
              resolvedType =
                  resolveType((Class<?>) parameterizedType.getRawType(), parameterizedType.getActualTypeArguments(),
                      getTypeClass(rootType));
          } else {
              resolvedType = resolveType(getTypeClass(rootType), null, getTypeClass(targetType));
          }
  
          return resolvedType;
      }
docs: Find and replace the generic parameters with the real types.
  
  @param targetType the type for which to resolve the parameters
  @param rootType an extending class as Type
  @return the Type with resolved parameters