code: @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
      public static Type preserveVariables(final Type type) {
          final List<TypeVariable> vars = GenericsUtils.findVariables(type);
          if (vars.isEmpty()) {
              return type;
          }
          final Map<String, Type> preservation = new HashMap<String, Type>();
          for (TypeVariable var : vars) {
              preservation.put(var.getName(), new ExplicitTypeVariable(var));
          }
          // replace TypeVariable to ExplicitTypeVariable
          return GenericsUtils.resolveTypeVariables(type, preservation);
      }
docs: Replace all {@link TypeVariable} into {@link ExplicitTypeVariable} to preserve variables.
  This may be required because in many places type variables are resolved into raw declaration bound.
  For example, useful for {@link TypesWalker} api.
  
  @param type type possibly containing variables
  @return same type if it doesn't contain variables or type with all {@link TypeVariable} replaced by
  {@link ExplicitTypeVariable}
  @see #resolveAllTypeVariables(Type, Map) to replace explicit varaibles