FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Support multi-field Java versions like `18.0.1.1` by brunoborges · Pull Request #1092 · actions/setup-java · GitHub

Support multi-field Java versions like 18.0.1.1 - #1092

Merged
brunoborges merged 1 commit into
mainfrom
brunoborges-support-four-part-java-version
Jul 9, 2026
Merged

Support multi-field Java versions like 18.0.1.1#1092
brunoborges merged 1 commit into
mainfrom
brunoborges-support-four-part-java-version

Conversation

Copy link
Copy Markdown
Contributor

Description:

Java's version scheme (JEP 322) can contain more than the three numeric fields that SemVer allows, for example 18.0.1.1 or 11.0.9.1 (the re-released 11.0.9 urgent fix). Passing such a value to java-version failed with The string '18.0.1.1' is not valid SemVer notation for a Java version, even though the README examples imply these exact/specific versions are supported.

This change normalizes exact multi-field versions into SemVer build notation before validation, reusing the existing convertVersionToSemver() helper (already used when parsing remote version lists): 18.0.1.1 becomes 18.0.1+1. The conversion is guarded by a strict regex (/^\d+(\.\d+){3,}$/) so version ranges, EA tags, and inputs that already carry +build metadata are left untouched. No downstream changes were needed: isVersionSatisfies() already compares build-metadata versions via semver.compareBuild, and the tool-cache path naming already maps + to -.

Related issue:
Fixes: #326

Check list:

  • Ran npm run check locally (format, lint, build, test) and all checks pass.
  • Mark if documentation changes are required. (README "Supported version syntax" updated to list multi-field versions.)
  • Mark if tests were added or updated to cover the changes. (Added normalizeVersion cases for 18.0.1.1, 11.0.9.1, 12.0.2.1.0, and an EA variant.)

Java's version scheme (JEP 322) can contain more than the three numeric
fields SemVer allows, e.g. 18.0.1.1 or 11.0.9.1. normalizeVersion()
rejected these inputs. Convert exact multi-field versions to SemVer build
notation (18.0.1.1 -> 18.0.1+1) before validation, reusing the existing
convertVersionToSemver() helper. Ranges, EA tags, and inputs that already
carry build metadata are left untouched.

Fixes: #326

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 9, 2026 19:18
brunoborges requested a review from a team as a code owner July 9, 2026 19:18

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Pull request overview

This pull request updates actions/setup-java to accept exact Java versions that use JEP 322’s multi-field numeric format (e.g. 18.0.1.1) by normalizing them into SemVer build-metadata form (e.g. 18.0.1+1) before SemVer validation. This aligns actual behavior with the README’s “exact/specific version” examples and fixes the reported input-validation failure.

Changes:

  • Normalize 4+ numeric-field exact version inputs in JavaBase.normalizeVersion() via existing convertVersionToSemver() prior to semver.validRange() validation.
  • Document multi-field Java version inputs in the README “Supported version syntax”.
  • Add test coverage for multi-field exact versions (and an EA variant) in normalizeVersion.
Show a summary per file
File Description
src/distributions/base-installer.ts Normalizes multi-field numeric Java versions into SemVer build metadata prior to validation.
README.md Documents that multi-field JEP 322 versions like 11.0.9.1 / 18.0.1.1 are supported inputs.
dist/setup/index.js Updates the compiled distribution output to include the new normalization logic.
tests/distributors/base-installer.test.ts Adds normalizeVersion test cases covering multi-field versions and an EA variant.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 3/4 changed files
  • Comments generated: 0
  • Review effort level: Low

brunoborges merged commit 3157986 into main Jul 9, 2026
407 checks passed
brunoborges deleted the brunoborges-support-four-part-java-version branch July 9, 2026 19:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

Java version 18.0.1.1 not supported as input value

2 participants


Back | FazBrowse Home | New Git URL