RFR: 7903788: preparation towards json configuration for jextract tool
Maurizio Cimadamore
mcimadamore at openjdk.org
Fri Aug 16 12:32:00 UTC 2024
On Fri, 16 Aug 2024 11:49:29 GMT, Athijegannathan Sundararajan <sundar at openjdk.org> wrote:
> * adding json skara code into org.openjdk.jextract.json.parser package. Minor changes done - pretty printing, JSONValue is made sealed and access changes (private final fields).
> * org.openjdk.jextract.json package for JSON interface to the rest of the jextract tool. Main interface is org.openjdk.jextract.json.JSON. parse and toString methods to convert record into JSON String and vice versa.
> * Other classes are public mainly for testing purposes. build.gradle adjusted with the required --add-exports clauses so that jextract module does not have to export the new json packages.
src/main/java/org/openjdk/jextract/json/JSONObjects.java line 638:
> 636: addNumberConverter(long.class, JSONNumber::asLong);
> 637: addNumberConverter(Long.class, JSONNumber::asLong);
> 638: addNumberConverter(OptionalInt.class, jn -> OptionalInt.of(jn.asInt()));
These last four seem odd
src/main/java/org/openjdk/jextract/json/JSONObjects.java line 677:
> 675: addDecimalConverter(float.class, JSONDecimal::asFloat);
> 676: addDecimalConverter(Float.class, JSONDecimal::asFloat);
> 677: addDecimalConverter(OptionalDouble.class, jd -> OptionalDouble.of(jd.asDouble()));
This seems a bit odd
src/main/java/org/openjdk/jextract/json/JSONObjects.java line 678:
> 676: addDecimalConverter(Float.class, JSONDecimal::asFloat);
> 677: addDecimalConverter(OptionalDouble.class, jd -> OptionalDouble.of(jd.asDouble()));
> 678: addDecimalConverter(BigDecimal.class, jd -> BigDecimal.valueOf(jd.asDouble()));
Not sure we'll ever use this one TBH?
-------------
PR Review Comment: https://git.openjdk.org/jextract/pull/257#discussion_r1719779871
PR Review Comment: https://git.openjdk.org/jextract/pull/257#discussion_r1719779583
PR Review Comment: https://git.openjdk.org/jextract/pull/257#discussion_r1719779441
More information about the jextract-dev
mailing list