Support multi-field Java versions like 18.0.1.1 (#1092)

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>
This commit is contained in:
Bruno Borges
2026-07-09 15:24:02 -04:00
committed by GitHub
parent 548a822bee
commit 3157986b3f
4 changed files with 28 additions and 2 deletions

View File

@@ -748,7 +748,11 @@ describe('normalizeVersion', () => {
['11.0', {version: '11.0', stable: true}],
['11.0.10', {version: '11.0.10', stable: true}],
['11-ea', {version: '11', stable: false}],
['11.0.2-ea', {version: '11.0.2', stable: false}]
['11.0.2-ea', {version: '11.0.2', stable: false}],
['18.0.1.1', {version: '18.0.1+1', stable: true}],
['11.0.9.1', {version: '11.0.9+1', stable: true}],
['12.0.2.1.0', {version: '12.0.2+1.0', stable: true}],
['18.0.1.1-ea', {version: '18.0.1+1', stable: false}]
])('normalizeVersion from %s to %s', (input, expected) => {
expect(DummyJavaBase.prototype.normalizeVersion.call(null, input)).toEqual(
expected