Repository navigation
[BUG]: .sdkmanrc with the installed name of an early-access build, such as java=28-ea+19, selects nothing #91
Description
Version
vfox-java main (bfcdbcc), vfox 1.0.13
OS
Linux
Describe the bug
A .sdkmanrc may name a JDK the way vfox list java shows it, and the e2e suite checks that java=21.0.8+9-tem selects 21.0.8+9-tem. The installed name of an early-access build selects nothing. With 21.0.8+9-tem, 28-ea+19 and 28-ea+18-zulu installed (vfox install java@28.ea.19 and java@28.ea.18-zulu install the last two under those names) and nothing set globally, running java in a directory whose .sdkmanrc has:
.sdkmanrc selected
java=21.0.8+9-tem 21.0.8+9-tem
java=28-ea+19 nothing (bash: java: command not found)
java=28-ea+18-zulu nothing (bash: java: command not found)
java=28.ea.19-open 28-ea+19
java=28.ea.18-zulu 28-ea+18-zulu
vfox use --global java@28-ea+19 and java@28-ea+18-zulu select them.
parse_version splits the name at each - and looks for the distribution in the second part, then the first, so it finds none in 28-ea+19 or 28-ea+18-zulu, and ParseLegacyFile then returns no version:
vfox-java/lib/distribution_version.lua
Lines 94 to 131 in bfcdbcc
| function distribution_version.parse_version(arg) | |
| local version_parts = strings.split(arg, "-") | |
| local version | |
| local distribution | |
| local javafx_bundled = false | |
| -- Check if the last part is "fx" and remove it, setting javafx_bundled flag | |
| if version_parts[#version_parts] == "fx" then | |
| javafx_bundled = true | |
| table.remove(version_parts) | |
| end | |
| if not version_parts[2] then | |
| -- no parts, check if we got a distribution name without version | |
| distribution = distribution_version.parse_distribution(version_parts[1]) | |
| if not distribution then | |
| -- no valid distribution found, handle as version with distribution "openjdk" | |
| version = version_parts[1] | |
| distribution = distribution_version.parse_distribution("openjdk") | |
| end | |
| else | |
| -- check if the distribution is in the second part of the string (vfox/sdkman default) | |
| distribution = distribution_version.parse_distribution(version_parts[2]) | |
| if distribution then | |
| -- valid distribution found, treat first part as version | |
| version = version_parts[1] | |
| else | |
| -- check if the distribution is in the first part of the string (asdf default) | |
| distribution = distribution_version.parse_distribution(version_parts[1]) | |
| if distribution then | |
| -- valid distribution found, treat second part as version | |
| version = version_parts[2] | |
| else | |
| -- invalid distribution name | |
| return nil | |
| end | |
| end | |
| end |
vfox-java/hooks/parse_legacy_file.lua
Lines 66 to 69 in bfcdbcc
| local distributionVersion = distribution_version_parser.parse_version(javaVersion) | |
| if not distributionVersion then | |
| return {} | |
| end |
PreUse passes such a version to vfox unchanged instead, and vfox finds it installed:
Lines 44 to 48 in bfcdbcc
| else | |
| return { | |
| version = input_version, | |
| } | |
| end |
SDKMAN writes early-access builds as 28.0.0.0+ea.20-open, which .sdkmanrc selects since #88, so this only takes a hand-written .sdkmanrc. Taking the version as written when vfox lists it as installed, before parsing it, would cover these.
Found while working on #86.
Activity
linghengqian commentedon Oct 17, 2026
I am working on the current issue.