Skip to content

[BUG]: vfox use java@27.0.0-librca reports not installed after vfox install java@27.0.0-librca installed 27+36-librca #87

Closed

Description

@linghengqian

Version
vfox-java main (00ced99), vfox 1.0.13

OS
Linux

Describe the bug
vfox install takes a version padded with zeros, the way SDKMAN writes them (#80), because Foojay drops the zeros itself: version=27.0.0 lists 27+36. vfox use with the same spelling then does not find what was installed:

spec                vfox install installs   vfox use --global java@<spec>
27-librca           27+36-librca            Now using java@27+36-librca.
27.0.0-librca       27+36-librca            java@27.0.0-librca is not installed
27.0.0+36-librca    27+36-librca            java@27.0.0+36-librca is not installed
25.0.1-open         25.0.1+8                Now using java@25.0.1+8.
25.0.1.0-open       25.0.1+8                java@25.0.1.0 is not installed

PreInstall passes the version on to Foojay as given:

local jdks = foojay.fetchtJdkList(distribution_version.distribution.name, distribution_version.version)

PreUse instead looks for an installed name starting with it, which 27+36-librca does not for 27.0.0, although the lookup means to take what PreInstall would have installed:

-- vfox uses the returned version as is, so return the installed one it
-- names or, without a match, the name for vfox to report as not installed.
local name = distribution_version.version .. suffix
return {
version = installed_version.find(ctx.installedSdks or {}, distribution_version.version, suffix) or name,
}

--- Returns the installed version that version .. suffix names, or nil. The
--- input may leave out the build number PreInstall found, so, like PreInstall,
--- take the newest build of a release (21.0.8-tem selects 21.0.8+9-tem) and
--- the newest release of a bare major (21-tem selects 21.0.12.1+1-tem), unless
--- the name itself is installed.
function installed_version.find(installed, version, suffix)
local name = version .. suffix
if installed[name] then
return name
end
-- A bare major takes any release of it (21.0.12.1+1 for 21) but no EA build
-- (26-ea+13 for 26); other versions take only a build number (not
-- 21.0.12.1+1 for 21.0.12, nor 21.0.12+8 for 21.0.1).
local rest = version:match("^%d+$") and "^[.+][%d.+]*$" or "^%+%d+$"
return installed_version.newest(installed, version, rest, suffix)
end

Dropping trailing .0 components before the lookup, as #85 does for .sdkmanrc, would line these up. Unlike SDKMAN's jbr, which vfox install and vfox use both reject (#71), here only vfox use does.

Found while working on #80.

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