elharo opened a new pull request, #177:
URL: https://github.com/apache/maven-toolchains-plugin/pull/177

   ## Summary
   
   Fixes #166
   
   The `version()` comparator in `ToolchainDiscoverer` used 
`String.compareTo()` for version segment comparison, which produces incorrect 
ordering for versions with different digit counts. For example, "8" was sorted 
before "11" and "17" because '8' > '1' lexicographically, and the reversed 
order incorrectly promoted JDK 8 over JDK 11/17.
   
   ## Changes
   
   - **ToolchainDiscoverer.java**: Replace `String.compareTo()` with 
`Integer.parseInt()` + `Integer.compare()` in the `version()` comparator for 
proper numeric version segment comparison
   - **ToolchainDiscovererTest.java**: Add `testVersionComparator()` test that 
verifies correct descending version ordering: 17 > 11 > 8
   
   ## Testing
   
   1. Added unit test `testVersionComparator()` that creates ToolchainModel 
objects with versions "8", "11", "17" and asserts descending sort order
   2. Test confirmed failing before the fix: `expected: <17> but was: <8>`
   3. Test passes after the fix


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to