code: public static Type preserveType(Type currentType, Type newType) {
          Type result = newType;
          if (newType != null && currentType != null &&
              currentType.getObjectClass() == newType.getObjectClass()) {
              if (newType.getGenericType().getGenericType() instanceof Class &&
                  !(currentType.getGenericType().getGenericType() instanceof Class)) {
                  if (newType.isNonNull() && !currentType.isNonNull()) {
                      result = currentType.toNonNull();
                  }
                  else if (!newType.isNonNull() && currentType.isNonNull()) {
                      result = currentType.toNullable();
                  }
              }
          }
  
          return result;
      }
docs: Preserve the current type's generic information with the specified new
  type if they have the same class.