private void checkStrictNumber(double number) {
    if (!isLenient() && (Double.isInfinite(number) || Double.isNaN(number))) {
      throw new IllegalArgumentException("JSON forbids NaN and infinities: " + number);
    }
  }
{@link JsonWriter} implementation backed by Jackson's {@link JsonGenerator}.
Provides measurable JSON writing improvements over Gson's native implementation.
Error reporting is might differ, however.
gson/src/org/immutables/gson/stream/JsonGeneratorWriter.java