Skip to content

Commit 45ebf7f

Browse files
committed
fix: make .sdkmanrc with SDKMAN's Mandrel and Liberica NIK identifiers, such as java=25.0.4.r25-nik, select the release they name
1 parent 60dd3df commit 45ebf7f

16 files changed

Lines changed: 305 additions & 18 deletions

‎docs/changes.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ What changed in each release, as a user notices it. GitHub's release pages list
88

99
- 13 more distributions, the rest of what Foojay lists: AdoptOpenJDK (`adpt`, `adptj9`), Eliya (`eliya`), OJDKBuild (`ojdkbld`), OpenLogic (`opnlgc`), Red Hat (`rdht`), Semeru certified (`semcrt`), Gluon GraalVM (`gln`) and GraalVM CE for JDK 8 to 19 (`grl8`, `grl11`, `grl16`, `grl17`, `grl19`). Red Hat installs from tar.xz, and OJDKBuild on Linux, OpenLogic on macOS and Gluon GraalVM before 22.1 from zips. A `.sdkmanrc` takes SDKMAN's old identifiers for them, such as `11.0.10.j9-adpt` and `22.3.3.r17-grl`. See [distributions.md](distributions.md).
1010
- Mandrel and Liberica NIK install by the GraalVM version they carry again: `java@23.1.12-mandrel` and `java@23.1.8-nik` work, `vfox search java mandrel` lists every release, and `java@23-mandrel` installs the newest 23.x, `23.1.12.1-mandrel`, which runs Java 21. In October 2026 Foojay moved that version from `java_version` to `distribution_version`, and since then release 0.6.2 fails on such versions with `No JDK found`, lists one Mandrel per Java major and installs Mandrel 23.1.8 for `java@21-mandrel`. Installs it made since then keep names after the Java version (`21-mandrel`, `21.0.12.1+2-nik`), and vfox still finds them by those names; uninstall one to get what the spec means now. See [distributions.md](distributions.md#behavior-of-mandrel-and-liberica-nik) ([#106](https://github.com/version-fox/vfox-java/issues/106)).
11+
- A `.sdkmanrc` takes SDKMAN's identifiers of Mandrel and Liberica NIK with the JDK after `.r`: `java=25.0.4.r25-nik` selects `25.0.4-nik`, where release 0.6.2 selects the newest installed release of the major. Of a release that comes for two JDKs, the plugin installs only the newer one's build, so `22.1.r11-mandrel` selects nothing. See [sdkmanrc.md](sdkmanrc.md#sdkmans-spellings) ([#109](https://github.com/version-fox/vfox-java/issues/109)).
1112
- The notes printed by `vfox add java`, `vfox update java` and `vfox info java` are a link to the README, which lists every short name and shows how to search a distribution. Release 0.6.2 gives five short names there but not how to list their versions, while `vfox search java` lists OpenJDK only ([vfox#390](https://github.com/version-fox/vfox/issues/390)).
1213

1314
## 0.6.2 (2026-10-18)

‎docs/development.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ A few contracts that cost time to find:
4646

4747
Installed names are `<java_version>[-<short name>][-fx]`, with no short name for OpenJDK and Foojay's `distribution_version` in place of `java_version` for Mandrel and Liberica NIK ([versions.md](versions.md#installed-names)). `lib/distribution_version.lua` reads a spec into a version, a distribution and the JavaFX flag, in either order (`21-tem`, `tem-21`). `lib/installed_version.lua` turns a version the user typed into an installed name: the name itself first. A bare major then takes the newest installed release of it, and any other version takes the release itself or its newest build. `PreUse` stops there. `ParseLegacyFile` goes one step further and falls back to the newest installed release of the major.
4848

49-
SDKMAN spells some things differently (`jbr`, `21.0.12.fx-zulu`, `21.0.12-fx+1.1-librca`, `28.0.0+ea.19-open`), and `plugin_spelling` in `hooks/parse_legacy_file.lua` rewrites them into the plugin's before parsing. For the distributions SDKMAN no longer lists, `sdkman_flavours` there turns the virtual machine or JDK in SDKMAN's version into the short name (`22.3.3.r17-grl` is `22.3.3-grl17`). `installed_version.unpad` drops the zeros SDKMAN pads releases with (`27.0.0+36` is `27+36`). Where the short names differ from SDKMAN's is in [distributions.md](distributions.md#short-names-and-sdkman).
49+
SDKMAN spells some things differently (`jbr`, `21.0.12.fx-zulu`, `21.0.12-fx+1.1-librca`, `28.0.0+ea.19-open`), and `plugin_spelling` in `hooks/parse_legacy_file.lua` rewrites them into the plugin's before parsing. For the distributions SDKMAN no longer lists, `sdkman_flavours` there turns the virtual machine or JDK in SDKMAN's version into the short name (`22.3.3.r17-grl` is `22.3.3-grl17`). For Mandrel and Liberica NIK (`sdkman_jdks`) the JDK is dropped (`25.0.4.r25-nik` is `25.0.4-nik`). An identifier with the older JDK of a release that comes for two, which `older_jdk` returns, selects nothing (`22.1.r11-mandrel`). `installed_version.unpad` drops the zeros SDKMAN pads releases with (`27.0.0+36` is `27+36`). Where the short names differ from SDKMAN's is in [distributions.md](distributions.md#short-names-and-sdkman).
5050

5151
## Foojay
5252

‎docs/e2e.md‎

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,15 @@ JDK, so `java` can only come from what vfox installs:
141141
weeks, so that install is faked: its `bin` holds a stand-in `java` that
142142
only prints the name. On Windows the file is written with CRLF line
143143
endings.
144+
145+
On the Temurin rows, a `.sdkmanrc` holding one of SDKMAN's identifiers of
146+
Mandrel and Liberica NIK with the JDK after `.r` must then select the
147+
release it names: `java=25.0.4.r25-nik` selects `25.0.4-nik`, not
148+
`25.0.4.1-nik`, which `ParseLegacyFile` took while it read `25.0.4.r25` as
149+
the release. `java=22.1.r11-mandrel` must select nothing, as the plugin
150+
installs only the JDK 17 build of Mandrel 22.1 (`OwnNumberIdentifiers` in
151+
`tests/e2e/common`). The releases they name and a newer one of each major
152+
are faked the same way.
144153
7. After `vfox use --global`, the JDK on `PATH` reports the requested
145154
`java.version`, the runner's `os.arch` (`amd64` / `aarch64`, which also
146155
catches an x64 JDK emulated on Windows ARM64) and the distribution's
@@ -165,13 +174,13 @@ JDK, so `java` can only come from what vfox installs:
165174
The default matrix runs every distribution against both vfox channels
166175
(`latest`, `main`):
167176

168-
| Distribution | Release | Covers | amd64 | arm64 |
169-
| ------------ | ------- | ---------------------------------------------------------------------------------------- | ----- | ----- |
170-
| `open` | 25.0.2 | the default distribution, versions without a suffix | ✓ | |
171-
| `tem` | 21.0.8 | the common path (tar.gz on Linux, zip on Windows); the name and number checks of item 4 | ✓ | ✓ |
172-
| `librca-fx` | 25.0.4 | JavaFX bundled builds (`-fx`) | ✓ | ✓ |
173-
| `jb` | 21.0.5 | the tar.gz path on Windows, which has no zip for it | ✓ | ✓ |
174-
| `graalce` | 25.0.2 | a `GRAALVM_HOME` set beforehand keeps its value; Oracle GraalVM's `25-graal` | ✓ | |
177+
| Distribution | Release | Covers | amd64 | arm64 |
178+
| ------------ | ------- | ---------------------------------------------------------------------------------------------- | ----- | ----- |
179+
| `open` | 25.0.2 | the default distribution, versions without a suffix | ✓ | |
180+
| `tem` | 21.0.8 | the common path (tar.gz on Linux, zip on Windows); the name and number checks of items 4 and 6 | ✓ | ✓ |
181+
| `librca-fx` | 25.0.4 | JavaFX bundled builds (`-fx`) | ✓ | ✓ |
182+
| `jb` | 21.0.5 | the tar.gz path on Windows, which has no zip for it | ✓ | ✓ |
183+
| `graalce` | 25.0.2 | a `GRAALVM_HOME` set beforehand keeps its value; Oracle GraalVM's `25-graal` | ✓ | |
175184

176185
Every pinned release is published through Foojay for each platform its row
177186
runs on. OpenJDK and GraalVM Community ship no `windows-aarch64` build, so

‎docs/sdkmanrc.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,15 @@ It never crosses to another distribution, between a JavaFX build and a plain one
5555
| `21.0.8+1.1-tem` | Temurin 21.0.8, see below |
5656
| `27.0.0+36-librca`, `25.0.1.0+8-open` | `27+36-librca`, `25.0.1+8`: the zeros are dropped |
5757
| `28.ea.19-open`, `28.0.0+ea.19-open` | the early-access build `28-ea+19` |
58+
| `25.0.4.r25-nik`, `25.0.2.r25-mandrel` | `25.0.4-nik`, `25.0.2-mandrel`: `.r` and the JDK after it are dropped |
5859
| `11.0.10.hs-adpt`, `11.0.10.j9-adpt` | AdoptOpenJDK with HotSpot, `11.0.10-adpt`, and with OpenJ9, `11.0.10-adptj9` |
5960
| `22.3.3.r17-grl` | GraalVM CE 22.3.3 for JDK 17, `22.3.3-grl17` |
6061
| `22.1.0.1.r17-gln` | Gluon GraalVM 22.1.0.1, `22.1.0.1-gln` |
6162

6263
The last three rows are SDKMAN's identifiers for distributions it no longer lists, with the virtual machine or the JDK in the version, see [distributions.md](distributions.md#short-names-and-sdkman). The plugin installs no JDK 11 build of Gluon GraalVM 22 and no AdoptOpenJDK upstream build, so `22.1.0.1.r11-gln` and `11.0.9.open-adpt` select nothing. Unreleased: release 0.6.2 selects nothing for any of the three.
6364

65+
SDKMAN writes the JDK into some versions of Mandrel and Liberica NIK as well, which the plugin names after the GraalVM version alone, see [distributions.md](distributions.md#behavior-of-mandrel-and-liberica-nik). Of a release that comes for two JDKs, the plugin installs only the build for the newer one, so an identifier with the older one selects nothing: `22.1.r11-mandrel`, `23.0.1.r17-nik`. The older JDK is 11 from 21.3 to 22.3.5 and 17 from 23 to 23.0.1.2. `25.r25-mandrel` has only the major and selects the newest installed Mandrel 25, as `java=25-mandrel` does, while SDKMAN installs 25.0.1.0 for it. Unreleased: release 0.6.2 takes `25.0.4.r25` for a release, finds none and selects the newest installed release of the major.
66+
6467
The number after `+` in SDKMAN's newer identifiers (`21.0.8+1.1-tem`) counts SDKMAN's own rebuilds. It is not a build number of the vendor, so the plugin does not look for one and takes the release. Foojay, and so the installed name, has no zero padding, which is why `27.0.0` means the release `27`. A `.0` padding in `sdk list java` is common (`25.0.1.0+8-open`, `21.0.9.0+116386-jbr`), and the plugin reads it as well.
6568

6669
## Not finding it

‎docs/zh-CN/changes.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
- 新增 13 个发行版,Foojay 列出的发行版从此全都有了:AdoptOpenJDK(`adpt`、`adptj9`)、Eliya(`eliya`)、OJDKBuild(`ojdkbld`)、OpenLogic(`opnlgc`)、Red Hat(`rdht`)、Semeru 认证版(`semcrt`)、Gluon GraalVM(`gln`),以及基于 JDK 8 到 19 的 GraalVM CE(`grl8`、`grl11`、`grl16`、`grl17`、`grl19`)。Red Hat 从 tar.xz 包安装;Linux 上的 OJDKBuild、macOS 上的 OpenLogic 和 22.1 以前的 Gluon GraalVM 从 zip 包安装。`.sdkmanrc` 里写 SDKMAN 以前给它们的标识符也认,例如 `11.0.10.j9-adpt`、`22.3.3.r17-grl`。见 [distributions.md](distributions.md)。
1010
- Mandrel 和 Liberica NIK 重新按它们沿用的 GraalVM 版本号安装:`java@23.1.12-mandrel` 和 `java@23.1.8-nik` 能装了,`vfox search java mandrel` 列出全部版本,`java@23-mandrel` 装最新的 23.x,即运行 Java 21 的 `23.1.12.1-mandrel`。2026 年 10 月,Foojay 把这个版本号从 `java_version` 挪到了 `distribution_version`,此后 0.6.2 装这样的版本都报 `No JDK found`,每个 Java 大版本只列一个 Mandrel,`java@21-mandrel` 装的是 Mandrel 23.1.8。这段时间里它装上的版本按 Java 版本号命名(`21-mandrel`、`21.0.12.1+2-nik`),vfox 仍会按这些名字找到它们;想要这个写法现在所指的版本,先把旧的卸载。见 [distributions.md](distributions.md#mandrel-与-liberica-nik-的行为)([#106](https://github.com/version-fox/vfox-java/issues/106))。
11+
- `.sdkmanrc` 里写 SDKMAN 给 Mandrel 和 Liberica NIK 的、`.r` 后面带 JDK 版本的标识符,会选中标识符指明的版本:`java=25.0.4.r25-nik` 选中 `25.0.4-nik`,0.6.2 选中的则是同一大版本里已安装的最新版本。一个版本同时为两个 JDK 发布时,插件只装较新 JDK 的构建,所以 `22.1.r11-mandrel` 什么都不会选中。见 [sdkmanrc.md](sdkmanrc.md#sdkman-的写法)([#109](https://github.com/version-fox/vfox-java/issues/109))。
1112
- `vfox add java`、`vfox update java` 和 `vfox info java` 打印的 Notes 改成了一个 README 链接,README 里列了全部简称,也写了怎样搜索某个发行版。0.6.2 的 Notes 只给了五个简称,没说怎样列出它们的版本,而 `vfox search java` 只列 OpenJDK([vfox#390](https://github.com/version-fox/vfox/issues/390))。
1213

1314
## 0.6.2(2026-10-18)

‎docs/zh-CN/development.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ vfox 加载 `metadata.lua`,命令需要时调用相应的钩子,并向钩子
4646

4747
安装后的版本名是 `<java_version>[-<简称>][-fx]`,OpenJDK 没有简称,Mandrel 和 Liberica NIK 用 Foojay 的 `distribution_version` 代替 `java_version`([versions.md](versions.md#安装后的版本名))。`lib/distribution_version.lua` 把一个写法解析成版本、发行版和 JavaFX 标志,两种顺序都接受(`21-tem`、`tem-21`)。`lib/installed_version.lua` 把用户输入的版本变成已安装的版本名:先看这个名字本身。只写大版本号时,取这个大版本里已安装的最新版本;其他写法则取这个版本本身,或它的最新构建。`PreUse` 到此为止。`ParseLegacyFile` 还会再退一步,取同一大版本里已安装的最新版本。
4848

49-
SDKMAN 有些写法不同(`jbr`、`21.0.12.fx-zulu`、`21.0.12-fx+1.1-librca`、`28.0.0+ea.19-open`),`hooks/parse_legacy_file.lua` 里的 `plugin_spelling` 会在解析之前把它们改写成插件自己的写法。对 SDKMAN 已经不再提供的发行版,同一文件里的 `sdkman_flavours` 把 SDKMAN 写在版本号里的虚拟机或 JDK 版本换成简称(`22.3.3.r17-grl` 就是 `22.3.3-grl17`)。SDKMAN 给版本补的零由 `installed_version.unpad` 去掉(`27.0.0+36` 就是 `27+36`)。简称与 SDKMAN 不同的地方见 [distributions.md](distributions.md#简称与-sdkman-的不同)。
49+
SDKMAN 有些写法不同(`jbr`、`21.0.12.fx-zulu`、`21.0.12-fx+1.1-librca`、`28.0.0+ea.19-open`),`hooks/parse_legacy_file.lua` 里的 `plugin_spelling` 会在解析之前把它们改写成插件自己的写法。对 SDKMAN 已经不再提供的发行版,同一文件里的 `sdkman_flavours` 把 SDKMAN 写在版本号里的虚拟机或 JDK 版本换成简称(`22.3.3.r17-grl` 就是 `22.3.3-grl17`)。对 `sdkman_jdks` 里的 Mandrel 和 Liberica NIK,则是去掉 JDK 版本(`25.0.4.r25-nik` 就是 `25.0.4-nik`)。一个版本同时为两个 JDK 发布时,写了较旧 JDK(由 `older_jdk` 给出)的标识符什么都不选中(`22.1.r11-mandrel`)。SDKMAN 给版本补的零由 `installed_version.unpad` 去掉(`27.0.0+36` 就是 `27+36`)。简称与 SDKMAN 不同的地方见 [distributions.md](distributions.md#简称与-sdkman-的不同)。
5050

5151
## Foojay
5252

‎docs/zh-CN/e2e.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ Windows 容器的覆盖(`tests/e2e/windows`)无法在开发容器里运行
4444
- EA 构建的标识符。固定大版本的 EA 构建,如果按 `sdk list java` 里 OpenJDK 的写法来写(`28.0.0.0+ea.20-open`),必须选中那个 EA 构建:`java=21.0.0.0+ea.1-tem` 要选中 `21-ea+1-tem`,不能选中 GA 版本。`ParseLegacyFile` 只认 SDKMAN 较旧的 `21.ea.1-tem` 写法时,选中的正是 GA 版本。安装后的版本名本身(`java=21-ea+1-tem`)也要能选中:`ParseLegacyFile` 以前解析不了它,什么也没选中,而 `vfox use` 是能选中的。
4545

4646
jdk.java.net 会在几周内撤掉每个 EA 构建,所以这个安装是模拟出来的:它的 `bin` 里放着一个只打印名字的替身 `java`。在 Windows 上,文件用 CRLF 换行写入。
47+
48+
接着,在 `tem` 这几行里,`.sdkmanrc` 里写的是 SDKMAN 给 Mandrel 和 Liberica NIK 的、`.r` 后面带 JDK 版本的标识符时,要选中标识符指明的版本:`java=25.0.4.r25-nik` 选中 `25.0.4-nik`,而不是 `25.0.4.1-nik`。`ParseLegacyFile` 以前把 `25.0.4.r25` 当成版本号,选中的正是后者。`java=22.1.r11-mandrel` 则什么都不能选中,因为插件只装 Mandrel 22.1 的 JDK 17 构建(`tests/e2e/common` 里的 `OwnNumberIdentifiers`)。标识符指明的版本,以及同一大版本里更新的一个版本,也是这样模拟安装的。
4749
7. `vfox use --global` 之后,`PATH` 上的 JDK 要报告请求的 `java.version`、runner 的 `os.arch`(`amd64` / `aarch64`,这也能抓出在 Windows ARM64 上模拟运行的 x64 JDK)和这个发行版的 `java.vendor`。`JAVA_HOME` 指向同一个 JDK,`javac` 能编译一个程序,`java` 能运行它,模块列表恰好在 `-fx` 构建里含有 JavaFX,`vfox current java` 报告已安装的版本。事先设置的 `GRAALVM_HOME` 保持原值,因为用户会把它指向自己的 GraalVM;对 GraalVM,插件以前会把它替换成正在使用的 JDK。
4850
8. `PreUse` 把用户输入的各种写法映射到已安装的版本,不需要再次下载:只写大版本号(`java@21`,交给 vfox 核心做模糊匹配)、安装时用的写法(`java@21.0.8-tem`,`PreUse` 会在已安装的版本里找到它的构建号),以及 asdf 风格的 `<长名>-<版本>[-fx]`(`java@temurin-21.0.8+9` 改写成 `21.0.8+9-tem`;`java@openjdk-25.0.2+10` 改写成 `25.0.2+10`)。SDKMAN 那样补零的版本也一样(`java@21.0.8.0-tem`、`java@21.0.8.0+9-tem`),`vfox install` 必须先发现它们已经安装:`PreInstall` 把零原样交给了 Foojay,Foojay 会去掉它,而 `PreUse` 以前去找以补零版本开头的已安装版本,报告说没有安装。
4951

@@ -52,7 +54,7 @@ Windows 容器的覆盖(`tests/e2e/windows`)无法在开发容器里运行
5254
| 发行版 | 版本 | 覆盖内容 | amd64 | arm64 |
5355
| ------------ | ------- | ---------------------------------------------------------------------------- | ----- | ----- |
5456
| `open` | 25.0.2 | 默认发行版,版本不带后缀 | ✓ | |
55-
| `tem` | 21.0.8 | 常规路径(Linux 上是 tar.gz,Windows 上是 zip);第 4 条里按名字和按版本号的检查 | ✓ | ✓ |
57+
| `tem` | 21.0.8 | 常规路径(Linux 上是 tar.gz,Windows 上是 zip);第 4、6 条里按名字和按版本号的检查 | ✓ | ✓ |
5658
| `librca-fx` | 25.0.4 | 带 JavaFX 的构建(`-fx`) | ✓ | ✓ |
5759
| `jb` | 21.0.5 | Windows 上走 tar.gz 的路径,那里没有 zip | ✓ | ✓ |
5860
| `graalce` | 25.0.2 | 事先设置的 `GRAALVM_HOME` 保持原值;Oracle GraalVM 的 `25-graal` | ✓ | |

0 commit comments

Comments
 (0)