Add 'latest' as alias for version 'x'

While it is possible to specify that you want the latest JDK version
by using semver X-Ranges (like 'x' for example), 'latest' is more
readable as explicitly states the intention.
This commit is contained in:
Plamen Totev 2020-04-12 18:30:31 +03:00
parent 5c87b70ffe
commit 3edd66d1b0
2 changed files with 8 additions and 0 deletions

View file

@ -36,6 +36,8 @@ Examples of version specifications that the java-version parameter will accept:
e.g. ```8.0.x, >11.0.3, >=13.0.1, <8.0.212```
e.g. ```latest``` (same as ```x```)
- An early access (EA) Java version
e.g. ```14-ea, 15-ea```

View file

@ -271,6 +271,12 @@ function getDownloadInfo(
}
function normalizeVersion(version: string): string {
// 'latest' means the most recent of any JDK version
// semver won't match pre-release versions
if (version === 'latest') {
version = 'x';
}
if (version.slice(0, 2) === '1.') {
// Trim leading 1. for versions like 1.8
version = version.slice(2);