code: public static ParameterizedType newParameterizedType(
        final Class<?> raw, Iterable<? extends Type> typeArgs) {
      TypeResolver resolver = new TypeResolver();
      final List<TypeVariable<?>> vars = new ArrayList<TypeVariable<?>>();
      for (Type arg : typeArgs) {
        TypeVariable<?> var = TypeVariableGenerator.freshTypeVariable("T" + vars.size());
        vars.add(var);
        resolver = resolver.where(var, arg);
      }
      checkArgument(raw.getTypeParameters().length == vars.size(),
          "%s expected %s type parameters, while %s are provied",
          raw, raw.getTypeParameters().length, typeArgs);
      return (ParameterizedType) resolver.resolveType(new ParameterizedType() {
        @Override public Class<?> getRawType() { return raw; }
        @Override public Type getOwnerType() { return null; }
        @Override public Type[] getActualTypeArguments() { return vars.toArray(new Type[0]); }
      });
    }
docs: TODO: infer types and check that 'raw' can be parameterized by 'typeArgs'.