@Override
  public void nextNull() throws IOException {
    BsonType type = delegate.getCurrentBsonType();
    if (type == BsonType.NULL) {
      delegate.readNull();
    } else if (type == BsonType.UNDEFINED) {
      delegate.readUndefined();
    } else {
      throw new IllegalStateException(String.format("Expected bson type %s or %s but got %s", BsonType.NULL, BsonType.UNDEFINED, type));
    }
  }
Gson library reads numbers lazily when using generic
{@link com.google.gson.internal.bind.TypeAdapters#JSON_ELEMENT} type adapter.
Number is read as string and then wrapped inside {@link LazilyParsedNumber}. This inefficiency
should only occur if reading numbers with generic JSON element API
and not using generated type adapters.
@see LazilyParsedNumber
@see com.google.gson.internal.bind.TypeAdapters#JSON_ELEMENT
mongo/src/org/immutables/mongo/bson4gson/BsonReader.java