public GsonBuilder newBuilder() {
    return new GsonBuilder(this);
  }
@Test
  public void testClonedTypeAdapterFactoryListsAreIndependent() {
    Gson original =
        new Gson(
            CUSTOM_EXCLUDER,
            CUSTOM_FIELD_NAMING_STRATEGY,
            new HashMap<>(),
            true,
            false,
            true,
            false,
            FormattingStyle.PRETTY,
            Strictness.LENIENT,
            false,
            true,
            LongSerializationPolicy.DEFAULT,
            null,
            DateFormat.DEFAULT,
            DateFormat.DEFAULT,
            new ArrayList<>(),
            new ArrayList<>(),
            new ArrayList<>(),
            CUSTOM_OBJECT_TO_NUMBER_STRATEGY,
            CUSTOM_NUMBER_TO_NUMBER_STRATEGY,
            Collections.emptyList());

    Gson clone =
        original.newBuilder().registerTypeAdapter(int.class, new TestTypeAdapter()).create();

    assertThat(clone.factories).hasSize(original.factories.size() + 1);
  }