Track the upstream move to the jdk.incubator.json module - #152
Conversation
Upstream moved the JSON API from java.base (java/util/json, jdk/internal/util/json) to a dedicated incubator module (src/jdk.incubator.json/share/classes/jdk/incubator/json). Repoint the tracker base URL, local-to-upstream path mapping, parser stubs and test assertions at the new location and document the tracking workflow. Verify: mvnd -pl json-java21-api-tracker -am test (11 tests green); a live run now reports the true drift (8 different, 1 missing upstream, 2 matching) instead of failing every fetch with 404s.
- json-java21/AGENTS.md step 4.5: upstream at c1a4f80 ships JsonAssertionException.java; it is not a local addition. Step 4.3: polyfill is package-local LazyConstant (upstream uses java.lang.LazyConstant since c1a4f80); StableValue.java is unused legacy pending removal. Updated local-additions table, javac verify list, transformation example and troubleshooting to match. - README.md Modifications: unnamed variables _ are renamed to e/v/k, not 'ignored'. Verified against upstream@c1a4f80 via per-file diffs; catalogue at .tmp/mechanical_changes_catalogue.md (scratch, not committed).
Mirror the upstream move of the JSON API from the jdk-sandbox into the jdk.incubator.json module as a pure token swap, no API changes: - git mv of jdk/sandbox source and test trees to jdk/incubator in json-java21 and json-compatibility-suite (34 files, history preserved) - global sed jdk.sandbox -> jdk.incubator and jdk/sandbox -> jdk/incubator across java, md, html, yml, py, pom and properties files in all modules - sync-process docs in json-java21/AGENTS.md and .github/copilot-instructions.md now name the new packages; api-tracker still maps jdk.incubator.java.util.json to the upstream raw path jdk/incubator/json Verify: mvn -B clean verify -DskipITs=false -> BUILD SUCCESS, 1355 tests, 0 failures, 0 errors, 0 skipped (matches the CI test-count assertion).
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1b868f5c30
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| <h3>Parse and access</h3> | ||
| <pre><code>import jdk.sandbox.java.util.json.*; | ||
| <pre><code>import jdk.incubator.java.util.json.*; |
There was a problem hiding this comment.
Pair the new import with the matching artifact version
The Quick Start still declares version 2026.01.26, which predates this package migration and exposes jdk.sandbox.java.util.json; users who copy this newly changed jdk.incubator.java.util.json import with that dependency will get package-not-found compilation errors. Update the dependency version to the release containing this rename so the adjacent snippets remain usable together.
AGENTS.md reference: AGENTS.md:L31-L35
Useful? React with 👍 / 👎.
Take upstream public API (11 files incl. new JsonValueException, package-info) and impl (10 files incl. new JsonGenerator, JsonValueSupport) with mechanical transforms: package mapping jdk.incubator.json.impl -> jdk.incubator.internal.util.json, jdk.incubator.json -> jdk.incubator.java.util.json; unnamed _ variables named (ignored/v); Utils.powExact polyfill re-applied (upstream uses Math.powExact); LazyConstant polyfill preserved (API identical). Deleted JsonAssertionException (replaced by upstream JsonValueException), JsonValueImpl (folded into JsonValueSupport) and dead StableValue polyfill. Docs updated accordingly.
Global rename per upstream 43325738c: bool->asBoolean, string->asString, toInt/toLong/toDouble->asInt/asLong/asDouble, elements->asList, members->asMap, element(int)->get(int), getOrAbsent->tryGet, valueOrNull->tryValue, JsonAssertionException->JsonValueException; toDisplayString indent int->String at all call sites; method references (JsonValue::asString etc.) and jtd-codegen emitted bytecode method names updated. Record accessors (Team.members, ElementsSchema.elements) kept.
- Port all nine upstream jtreg/junit test files from jdk-sandbox json branch at frontier 43325738c into json-java21 (TestAccess, TestGenerate, TestJsonArray, TestJsonLiteral, TestJsonNumber, TestJsonObject, TestJsonString, TestOtherImpl, TestParse): mechanical jtreg header removal, package rename, FieldSource to MethodSource (JUnit 5.10), boxed type patterns for the Java 21 backport of factoryTest. - Add JsonTestLoggingConfig base class (JUL per repo test rules) and JsonNumberOfDoubleMatrixTest proving issue #118 is closed by upstream: of(double) now computes decimal/exponent offsets via indexOf and the reworked JsonNumberImpl handles integral doubles, fractions, negatives, zero variants and out-of-range conversions identically to the historic of(String) delegation fix. - Add junit-jupiter-params test dependency to json-java21. - README: bump synced frontier anchor c1a4f80 to 43325738c (2026-08-27), mark the incubator migration DONE (issue #145), refresh stale accessor lists (asString/asLong/asInt/asBoolean/asList/asMap, tryGet/tryValue), fix JsonParseException getErrorLine/getErrorPosition example, record the #118 closed-by-upstream disposition in Upstream Bug Fixes. - ci.yml: exp_tests 1355 -> 1665 (full clean verify, all modules green).
Audit of the full JSON number-math input space after the 43325738c uplift
found the ported upstream tests rigorous except for boundary extremes:
Integer.MIN_VALUE / Long.MIN_VALUE as accepted conversions, exponents at
the int boundaries (1e2147483647 / 1e2147483648 / 1e-2147483648 /
1e-2147483649) that exercise Math.addExact/subtractExact/negateExact and
the Utils.powExact polyfill, parsed -0 value semantics, the
JsonNumber.of(String) whitespace contract, and Json.parse("-")/parse("").
New JsonNumberBoundaryTest (10 tests) covers these; expected behaviour is
sourced from the JsonValue javadoc ranges, the upstream implementation
and RFC 8259 section 6. TestJsonNumberOfDouble now extends
JsonTestLoggingConfig and drops its ad-hoc System.out per module test
rules. Full suite 1665 -> 1675; ci.yml exp_tests updated.
How to verify:
/opt/homebrew/bin/mvnd -pl json-java21 test -Djava.util.logging.ConsoleHandler.level=INFO
/opt/homebrew/bin/mvnd clean verify -Djava.util.logging.ConsoleHandler.level=INFO (all modules green)
- Delete unannotated dead TestJsonLiteral.conversionTest() (upstream-faithful; assertions already covered by live booleanOfTest()) - Wire ReadmeExamples into ReadmeExamplesTest so the README.md and index.html promise of a runnable examples class is test-enforced (exp_tests 1675 -> 1676) - ApiTracker: delete unreachable NOT_IMPLEMENTED/PARSE_NOT_IMPLEMENTED status path (nothing produces that status) and fix discoverLocalJsonClasses javadoc to match the actual packages list - ApiTrackerRunner: delete parsed-but-ignored binary|source mode and sourcepath args; both workflows invoke with only the log level argument - LazyConstant: drop stale comment referencing the removed StableValue polyfill - Remove 15 unused imports across jtd, jtd-codegen, jsonpath and compatibility suite sources - Delete 8 stray pom.xml.versionsBackup files (untracked; .gitignore already covers the pattern) Verify: mvnd clean verify green; surefire totals tests=1676 failures=0 errors=0 skipped=0.
Mechanical package move mirroring the upstream relocation of the JSON API from the jdk-sandbox into the
jdk.incubator.jsonmodule. Pure token swap, no API changes:git mvof thejdk/sandboxsource and test trees tojdk/incubatorinjson-java21andjson-compatibility-suite(34 files, history preserved)jdk.sandbox→jdk.incubatorandjdk/sandbox→jdk/incubatortoken swap across all modules (java, md, html, yml, py, pom files), including.github/copilot-instructions.mdjson-java21/AGENTS.mdsync-process docs now name the new packages; the API tracker still mapsjdk.incubator.java.util.jsonto the upstream raw pathjdk/incubator/jsonVerification:
mvn -B clean verify -DskipITs=false→ BUILD SUCCESS with 1355 tests, 0 failures, 0 errors, 0 skipped, matching the CI test-count assertion. Zero remaining references to the old names (rgandgit grepboth clean).Closes #145
Further commits will follow on this same branch — the API uplift to upstream frontier
43325738ccomes next.