You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Version comparator in ToolchainDiscoverer uses lexicographic String.compareTo instead of numeric version comparison #166
The version() comparator in ToolchainDiscoverer.java uses String.compareTo() for version comparison, which is lexicographic rather than numeric. This produces incorrect sort orders for JDK versions with different digit counts.
The .reversed() at the end means higher versions should sort first, but this bug corrupts the ordering for any comparison between single-digit and multi-digit major versions.
Impact
JDK toolchain discovery and selection produces wrong sort order, which means select-jdk-toolchain may choose a suboptimal JDK. For example, if JDK 8 and JDK 11 are both available and match requirements, JDK 8 could be incorrectly preferred over JDK 11.
Suggested Fix
Use proper numeric version comparison (e.g., split segments and compare each segment as integers, or use a dedicated version comparator like ComparableVersion from Maven artifact API).
a dedicated version comparator like ComparableVersion from Maven artifact API is not appropriate here. That compares Maven artifact version strings. This needs to compare JDK version strings which are not quite the same. Custom code is required.
Activity
Fix version comparator: use numeric comparison instead of lexicograph…
Revert accidental direct push of version comparator fix (#178)
Fix version comparator: use numeric comparison with non-numeric segme…
elharo commentedon Jul 22, 2026
a dedicated version comparator like ComparableVersion from Maven artifact API is not appropriate here. That compares Maven artifact version strings. This needs to compare JDK version strings which are not quite the same. Custom code is required.