Skip to content

[BUG]: .sdkmanrc with the installed name of an early-access build, such as java=28-ea+19, selects nothing #91

Closed

Description

@linghengqian

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:

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

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:

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

  1. linghengqian commented on Oct 17, 2026

    @linghengqian
    MemberAuthor

    I am working on the current issue.

  2. self-assigned this
    on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions