On Fri, 14 Aug 2026 14:26:49 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/JsonValue.java line > 101: > >> 99: * {@code long} if its numeric value can be represented exactly.</li> >> 100: * <li>{@code asDouble()} converts a {@code JsonNumber} instance to >> a Java >> 101: * {@code double} if its numeric value can be represented >> accurately.</li> > > You addressed my previous comment about JsonNumber::asDouble doing the > conversion with Double.parseDouble and rounding to the nearest representable > double. I'm just wondering now about the class description where it uses > "represented accurately" as it seems to conflict. This particular text is shared from the JEP, so it intentionally does not get into too much detail at this point. Would you be okay with "if its numeric value can be rounded to a finite Java double"? I think we want to avoid relying on `Double.parseDouble` at this point. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/32282#discussion_r3785667405
