google / gson

A Java serialization/deserialization library to convert Java Objects into JSON and back
Apache License 2.0
23.3k stars 4.28k forks source link

Support strict mode for `JsonParser` #2648

Closed Marcono1234 closed 6 months ago

Marcono1234 commented 6 months ago

Purpose

Support strict parsing for JsonParser

Description

Since the Strictness API (#2323) has not been released yet, we can fix the parsing of JsonParser in the same backward compatible way we fixed it for the Gson methods:

This pull request also changes the getStrictness() == Strictness.LEGACY_STRICT checks in Gson to make the intention clearer that this is for backward compatibility. Behavior-wise they still act like before:

Checklist