Describe the bug
When the Java home settings are not set, a JDK configured through JDK_HOME may not be listed first if another JDK is also detected from JAVA_HOME or PATH.
JDK_HOME seems to be intended as the highest-priority source.
To Reproduce
- Leave java.jdt.ls.java.home, java.home, and java.configuration.runtimes unset.
- Make sure java.configuration.detectJdksAtStart is enabled.
- Configure JDK_HOME with one valid JDK.
- Configure JAVA_HOME, or PATH, with a different valid JDK.
- Restart VS Code.
- Open Java: Configure Java Runtime and check the detected JDK order.
Actual behavior
The JDK from JDK_HOME may appear after the other detected JDK.
Expected behavior
The JDK from JDK_HOME should appear first.
Environment
- Operating System: macOS
- JDK version: JDK 17 from JDK_HOME, JDK 25 from JAVA_HOME
- Visual Studio Code version: 1.125.0-insider
- Java extension version: 1.55.0
Additional Information
sortJdksBySource() gives JDK_HOME rank 0, but the later rank check does not treat 0 as an assigned rank.
Describe the bug
When the Java home settings are not set, a JDK configured through JDK_HOME may not be listed first if another JDK is also detected from JAVA_HOME or PATH.
JDK_HOME seems to be intended as the highest-priority source.
To Reproduce
Actual behavior
The JDK from JDK_HOME may appear after the other detected JDK.
Expected behavior
The JDK from JDK_HOME should appear first.
Environment
Additional Information
sortJdksBySource() gives JDK_HOME rank 0, but the later rank check does not treat 0 as an assigned rank.