public Gson create() {
    List<TypeAdapterFactory> factories =
        new ArrayList<>(this.factories.size() + this.hierarchyFactories.size() + 3);
    factories.addAll(this.factories);
    Collections.reverse(factories);

    List<TypeAdapterFactory> hierarchyFactories = new ArrayList<>(this.hierarchyFactories);
    Collections.reverse(hierarchyFactories);
    factories.addAll(hierarchyFactories);

    addTypeAdaptersForDate(datePattern, dateStyle, timeStyle, factories);

    return new Gson(
        excluder,
        fieldNamingPolicy,
        new HashMap<>(instanceCreators),
        serializeNulls,
        complexMapKeySerialization,
        generateNonExecutableJson,
        escapeHtmlChars,
        formattingStyle,
        strictness,
        serializeSpecialFloatingPointValues,
        useJdkUnsafe,
        longSerializationPolicy,
        datePattern,
        dateStyle,
        timeStyle,
        new ArrayList<>(this.factories),
        new ArrayList<>(this.hierarchyFactories),
        factories,
        objectToNumberStrategy,
        numberToNumberStrategy,
        new ArrayList<>(reflectionFilters));
  }
@Test
  public void testDefaultStrictness() throws IOException {
    GsonBuilder builder = new GsonBuilder();
    Gson gson = builder.create();
    assertThat(gson.newJsonReader(new StringReader("{}")).getStrictness())
        .isEqualTo(Strictness.LEGACY_STRICT);
    assertThat(gson.newJsonWriter(new StringWriter()).getStrictness())
        .isEqualTo(Strictness.LEGACY_STRICT);
  }