Skip to content

Track the upstream move to the jdk.incubator.json module - #152

Merged
simbo1905 merged 9 commits into
mainfrom
issue-145-track-jdk-incubator-json
Aug 30, 2026
Merged

Track the upstream move to the jdk.incubator.json module#152
simbo1905 merged 9 commits into
mainfrom
issue-145-track-jdk-incubator-json

Conversation

@simbo1905

Copy link
Copy Markdown
Owner

Mechanical package move mirroring the upstream relocation of the JSON API from the jdk-sandbox into the jdk.incubator.json module. Pure token swap, no API changes:

  • git mv of the jdk/sandbox source and test trees to jdk/incubator in json-java21 and json-compatibility-suite (34 files, history preserved)
  • Global jdk.sandboxjdk.incubator and jdk/sandboxjdk/incubator token swap across all modules (java, md, html, yml, py, pom files), including .github/copilot-instructions.md
  • json-java21/AGENTS.md sync-process docs now name the new packages; the API tracker still maps jdk.incubator.java.util.json to the upstream raw path jdk/incubator/json

Verification: 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 (rg and git grep both clean).

Closes #145

Further commits will follow on this same branch — the API uplift to upstream frontier 43325738c comes next.

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).
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-30T06:21:07.050257Z 1b868f5 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread index.html

<h3>Parse and access</h3>
<pre><code>import jdk.sandbox.java.util.json.*;
<pre><code>import jdk.incubator.java.util.json.*;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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.
@simbo1905
simbo1905 merged commit 3cc73b0 into main Aug 30, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Track the upstream move to the jdk.incubator.json module

1 participant