| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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>
There was a problem hiding this comment.
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:
| 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. |
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
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: