Skip to content

Support Temurin JEP 322 patch versions like 26.0.2.1+1 - #1279

Merged
brunoborges merged 2 commits into
mainfrom
brunoborges-fix-temurin-four-part-version
Oct 2, 2026
Merged

brunoborges merged 2 commits into
mainfrom
brunoborges-fix-temurin-four-part-version

Conversation

@brunoborges

Copy link
Copy Markdown
Contributor

Description:
Temurin now publishes respins with a JEP 322 patch field (for example 26.0.2.1+1 and 25.0.4.1+1). In v6, java-version: 26.0.2.1+1 fails with "is not valid SemVer notation", and the version could not have resolved anyway:

  1. normalizeVersion only converted 4+ field versions without build metadata, so X.Y.Z.P+B was rejected.
  2. The Adoptium API version_data.semver encodes the patch into the build number (26.0.2.1+1 -> 26.0.2+101) and appends metadata for LTS releases (25.0.4+7 -> 25.0.4+7.0.LTS), so an exact OpenJDK-style request never matches.

Changes:

  • New normalizeJavaVersionToSemver helper in src/util.ts that maps X.Y.Z.P[+B] to X.Y.Z+P[.B] (consistent with convertVersionToSemver and the Liberica compound-build handling from Preserve compound Liberica build versions from .sdkmanrc #1268). Used by JavaBase.normalizeVersion and the Temurin jdk+jmods version check in package-types.ts.
  • Temurin resolvePackage: for exact (build-qualified) requests, also match against a key derived from the OpenJDK fields (major.minor.security+[patch.]build). The API semver is still used as the resolved version, for sorting, and for tool-cache paths, so ranges (25, 26.0.2, x) behave as before and pick the newest respin.
  • Side effect: exact LTS requests like 25.0.4+7 now resolve remotely (previously only a tool-cache hit worked).
  • README: added 26.0.2.1+1 to the supported version syntax table.
  • Rebuilt dist/.

Known limitation: an exact 26.0.2.1 without build metadata still won't match a respin; 26.0.2.1+1 or 26.0.2 work.

Verified locally against the live Adoptium API by running dist/setup/index.js: 26.0.2.1+1 -> 26.0.2+101, 25.0.4.1+1 -> 25.0.4+101.0.LTS, 25.0.4+7 -> 25.0.4+7.0.LTS, all downloaded successfully.

Related issue:
Fixes: #1270

Check list:

  • Ran npm run check locally (format, lint, build, test) and all checks pass. (45 suites, 1512 tests passed)
  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

Accept 4-part versions with build metadata (X.Y.Z.P+B -> X.Y.Z+P.B) and
match exact Temurin requests against OpenJDK-derived version keys, since the
Adoptium API semver folds the patch into the build number (26.0.2+101) and
adds LTS metadata (25.0.4+7.0.LTS).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 2, 2026 04:03
@brunoborges
brunoborges requested a review from a team as a code owner October 2, 2026 04:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The implementation is consistent across source and generated bundles and includes focused regression coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Adds support for Temurin JEP 322 respin versions while preserving existing range resolution behavior.

Changes:

  • Normalizes multi-field Java versions with build metadata.
  • Matches exact Temurin requests against reconstructed OpenJDK versions.
  • Adds documentation, tests, and rebuilt runtime bundles.
File Description
src/​util.ts Adds shared Java-version normalization.
src/​distributions/​temurin/​models.ts Models the optional patch field.
src/​distributions/​temurin/​installer.ts Resolves exact respin and LTS versions.
src/​distributions/​package-types.ts Normalizes versions for jmods validation.
src/​distributions/​base-installer.ts Applies shared normalization to inputs.
README.md Documents respin syntax.
dist/​setup/​index.js Rebuilds setup utility bundle.
dist/​setup/​463.index.js Rebuilds Temurin installer bundle.
dist/​setup/​242.index.js Rebuilds base installer bundle.
dist/​cleanup/​index.js Rebuilds cleanup bundle.
__tests__/​util.test.ts Tests normalization cases.
__tests__/​distributors/​temurin-installer.test.ts Tests respin and LTS resolution.
__tests__/​distributors/​distribution-factory.test.ts Tests jmods compatibility checks.
__tests__/​distributors/​base-installer.test.ts Tests input normalization.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@brunoborges
brunoborges merged commit 47b3648 into main Oct 2, 2026
82 of 85 checks passed
@brunoborges
brunoborges deleted the brunoborges-fix-temurin-four-part-version branch October 2, 2026 04:09
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.

Temurin version incorrectly converted for setup-java 6.0.x

2 participants