On Tue, 11 Aug 2026 14:59:58 GMT, Alan Bateman <[email protected]> wrote:

>> This PR implements [JEP 540: Simple JSON API 
>> (Incubator)](https://openjdk.org/jeps/540).
>> 
>> It adds the `jdk.incubator.json` module which provides APIs for reading and 
>> writing JSON documents as specified by [RFC 
>> 8259](https://datatracker.ietf.org/doc/html/rfc8259). This is an incubating 
>> API.
>> 
>> API documentation: 
>> https://cr.openjdk.org/~naoto/json/javadoc/api/jdk.incubator.json/module-summary.html
>> Co-authored-by: Justin Lu 
>> ([@justin-curtis-lu](https://github.com/justin-curtis-lu))
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> src/jdk.incubator.json/share/classes/jdk/incubator/json/Json.java line 98:
> 
>> 96:      * @return the parsed {@code JsonValue}
>> 97:      */
>> 98:     public static JsonValue parse(char[] in) {
> 
> I assume one of the things to get feedback on while the API is incubator is 
> which parse methods to add. If parse(char[]) stays then it will need to 
> specify that changes to the array after it the payload has been parsed are 
> ignored.

Yes, this will need to be ironed out during the incubation period.

> src/jdk.incubator.json/share/classes/jdk/incubator/json/JsonObject.java line 
> 101:
> 
>> 99:      * @param map the map of {@code JsonValue}s. Non-null.
>> 100:      * @throws IllegalArgumentException if duplicate member names are 
>> given in
>> 101:      *      {@code map}.
> 
> A Map can't have duplicate keys.  It might have to be expanded to be clear 
> that it means duplicate keys encountering when iterating over the mappings.

I think it is possible to have an IdentityHashMap to have duplicate member 
names. Clarified it a bit.

> src/jdk.incubator.json/share/classes/jdk/incubator/json/JsonParseException.java
>  line 58:
> 
>> 56:     /**
>> 57:      * Constructs a JsonParseException with the specified detail message.
>> 58:      * @param message the detail message
> 
> can be null I assume.

It is a RuntimeException and it allows null, so the same behavior.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/32282#discussion_r3761437481
PR Review Comment: https://git.openjdk.org/jdk/pull/32282#discussion_r3761332060
PR Review Comment: https://git.openjdk.org/jdk/pull/32282#discussion_r3761356601

Reply via email to