Repository navigation
fix: read five-part OpenJDK versions such as 17.0.21.0.2 - #593
Conversation
|
This pull request is merged. |
7fd2e04 to
4a617e5
Compare
Xiaoy312
left a comment
There was a problem hiding this comment.
The fix looks correct to me. Five-part versions are now compared on their first four parts and still shown in full. A javac whose version can't be read is listed instead of dropped. The failure message names what was found, and the same text goes into the --json output. A few comments, none blocking:
1. The new message can contradict itself when the path check rejects a JDK (OpenJdkCheckup.cs, the microsoft/openjdk path check in Examine and FormatIncompatibleMessage)
A JDK only counts as compatible if its path contains microsoft or openjdk. So a Temurin 17.0.20 at /usr/lib/jvm/temurin-17-jdk-amd64 is rejected, and the message then says:
OpenJDK 17.0.19 or later is required, but none of the JDKs found is compatible: 17.0.20 (/usr/lib/jvm/temurin-17-jdk-amd64).
Since 17.0.20 is newer than 17.0.19, the message contradicts itself. GitHub's Ubuntu runners ship Temurin, so a stock runner will show this. It's not a regression, because the old "OpenJDK 17 is missing" was also wrong here, but it could be fixed with a small change: mark the JDKs rejected by the path check, e.g. 17.0.20 (/usr/lib/jvm/temurin-17-jdk-amd64, not a Microsoft/OpenJDK build), or word the requirement so it includes the vendor. A test for it would be good too. This can be a follow-up.
2. The Linux wording isn't tested in CI (OpenJdkCheckupTests.cs:82)
Assert.DoesNotContain("missing", result.Suggestion.Description ?? string.Empty) only checks something on Linux. On Windows and macOS the code takes the download-and-install (BootsSolution) branch, where the description never said "missing", so the assert always passes there. CI runs the tests only on windows-latest, so the Linux description change, on the platform where the bug happened, is never checked. Moving the choice of description into a small static helper would make it testable on every OS.
3. Each incompatible JDK is printed twice (nit, OpenJdkCheckup.cs:123)
Each incompatible JDK is printed as a status line, then listed again in the error line. That's fine, just a bit noisy.
Fixes #590
Microsoft OpenJDK
17.0.21.0.2reports a five-part version, whichNuGetVersioncan't parse. The OpenJDK checkup dropped that JDK without any output, then reported "OpenJDK 17 is missing", even though the installed version is newer than the required17.0.19. This breaks the Linux Android jobs in unoplatform/uno CI.Changes
All in
OpenJdkCheckup:17.0.21.0.2→17.0.21.0), which is enough to check it against the manifest. The output still shows the full17.0.21.0.2.javacwhose version can't be read is listed as<path>/javac (version not recognized)instead of being dropped.javacwas found. Otherwise the error lists what was found, e.g.OpenJDK 17.0.19 or later is required, but none of the JDKs found is compatible: 17.0.16 (/usr/lib/jvm/temurin-17-jdk-amd64).The message is also set on the result, so--jsonreports it.Tests
OpenJdkCheckupTests:javac 17.0.16,17.0.20.1and17.0.21.0.2.17.0.21.0.2meets17.0.19and sorts above17.0.20.1.javacfound, a JDK that is too old, ajavacwhose version can't be read, an exact required version, and the--jsonmessage.389/389 tests pass locally. With the parsing change reverted, the five-part tests fail. The Release build has no warnings in the changed files; the existing warnings are unchanged.
Follow-up
Once a uno-check build with this fix is published, unoplatform/uno can bump
GlobalUnoCheckVersionand revert themsopenjdk-17=17.0.20.1-1pin from unoplatform/uno#25680.