Skip to content

Fix #4426: preserve JDK_HOME priority when sorting JDKs - #4427

Merged
datho7561 merged 1 commit into
redhat-developer:mainfrom
shblue21:fix-jdk-home-priority
Oct 19, 2026
Merged

datho7561 merged 1 commit into
redhat-developer:mainfrom
shblue21:fix-jdk-home-priority

Conversation

@shblue21

Copy link
Copy Markdown
Contributor

JDK_HOME is assigned the highest source priority in sortJdksBySource(), but the rank check treated rank 0 as if no rank had been assigned. That allowed later source ranking to overwrite the JDK_HOME entry and sort it after lower-priority detected JDKs.

This changes the check to look for an assigned numeric rank and adds a regression test for the ordering.

Fixes #4426

@shblue21
shblue21 force-pushed the fix-jdk-home-priority branch from af0ac84 to b915526 Compare June 16, 2026 12:05
@shblue21
shblue21 force-pushed the fix-jdk-home-priority branch from b915526 to 4bf7d1e Compare June 16, 2026 12:05
@robstryker

Copy link
Copy Markdown
Contributor

@MeherSru Can you test this PR please?

@MeherSru MeherSru left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with JDK_HOME=26 and JAVA_HOME=25, main picks 25, and with this fix it picks 26. Works as expected, LGTM 👍

@datho7561
datho7561 merged commit fd159e8 into redhat-developer:main Oct 19, 2026
2 checks passed
@shblue21

Copy link
Copy Markdown
Contributor Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JDK_HOME can be sorted after lower-priority auto-detected JDK sources

4 participants