Skip to content

Accept Temurin four field versions with build metadata - #1271

Open
Hashim1999164 wants to merge 3 commits into
actions:mainfrom
Hashim1999164:fix/temurin-four-field-semver
Open

Hashim1999164 wants to merge 3 commits into
actions:mainfrom
Hashim1999164:fix/temurin-four-field-semver

Conversation

@Hashim1999164

Copy link
Copy Markdown

Fixes #1270

Temurin publishes versions like 26.0.2.1+1. normalizeVersion only rewrote pure four field strings (e.g. 18.0.1.1), so those values failed the SemVer check on setup-java 6.x.

convertVersionToSemver now folds the extra numeric fields into SemVer build metadata and keeps any existing +build suffix (26.0.2.1+1 -> 26.0.2+1.1). normalizeVersion matches the same pattern.

Test plan

  • npm test -- --testPathPatterns=util.test --coverage=false
  • npm test -- --testPathPatterns=base-installer.test --testNamePattern=normalizeVersion --coverage=false
  • npm run build

normalizeVersion only converted pure four field versions like 18.0.1.1, so Temurin strings such as 26.0.2.1+1 failed the SemVer check. Fold the extra fields into build metadata and keep any existing +build suffix.
@Hashim1999164
Hashim1999164 requested a review from a team as a code owner September 18, 2026 13:42
@johnoliver

Copy link
Copy Markdown
Contributor

This might be over engineering, but according to JEP322 there is no limit on how many numbers there can be in a version, not sure how much work it would be to just allow any arbitrary number of numbers.

Comment thread __tests__/distributors/base-installer.test.ts
@brunoborges

Copy link
Copy Markdown
Contributor

@johnoliver @Hashim1999164 I wonder if we should allow major version and full version only. Example: 26 matches latest 26. Any other 26.<something>... has to match the exact version.

Thoughts?

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

🟡 Changes recommended

Temurin validation and candidate matching do not consistently normalize four-field versions with build metadata.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds support for Temurin four-field versions with build metadata, such as 26.0.2.1+1.

Changes:

  • Extends SemVer conversion and normalization.
  • Updates bundled setup and cleanup artifacts.
  • Adds utility and installer regression tests.
File Summary
src/​util.ts Adds build-metadata-aware version conversion.
src/​distributions/​base-installer.ts Applies four-field normalization; moderate issues remain in pre-validation, JMOD gating, and candidate matching.
dist/​setup/​index.js Updates the bundled utility.
dist/​setup/​242.index.js Updates the bundled installer.
dist/​cleanup/​index.js Updates the bundled utility.
__tests__/​util.test.ts Adds conversion coverage.
__tests__/​distributors/​base-installer.test.ts Adds normalization coverage.

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

Comment thread src/distributions/base-installer.ts
@Hashim1999164

Hashim1999164 commented Sep 25, 2026 •

Copy link
Copy Markdown
Author

@brunoborges @johnoliver yeah i was just trying to make the four field temurin builds like 26.0.2.1+1 actually resolve instead of getting tossed. major only (26) plus exact full string feels fine to me if thats what yall prefer. arbitrary length jep322 versions idk how deep that rabbit hole goes in the installer matching code bro i dont know that lmao. happy to slim the matcher if you want major + exact only.

@Hashim1999164
Hashim1999164 force-pushed the fix/temurin-four-field-semver branch from 3c1b9c7 to 28a9132 Compare September 27, 2026 12:15
@Hashim1999164

Copy link
Copy Markdown
Author

@johnoliver @brunoborges pushed a follow up so the jmods gate normalizes four field versions that already have +build the same way JavaBase does. also clarified the 26.0.2.1+1 -> 26.0.2+1.1 fold order in the util test. still happy to slim matching to major + exact full string if thats the direction yall want.

This branch has not been deployed

No deployments
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

4 participants