Skip to content

fix: read five-part OpenJDK versions such as 17.0.21.0.2 - #593

Merged
agneszitte merged 2 commits into
mainfrom
dev/ap/590-openjdk-five-part-version
Nov 11, 2026
Merged

agneszitte merged 2 commits into
mainfrom
dev/ap/590-openjdk-five-part-version

Conversation

@ajpinedam

Copy link
Copy Markdown
Contributor

Fixes #590

Microsoft OpenJDK 17.0.21.0.2 reports a five-part version, which NuGetVersion can'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 required 17.0.19. This breaks the Linux Android jobs in unoplatform/uno CI.

Changes

All in OpenJdkCheckup:

  • Five-part versions: the version is compared on its first four parts (17.0.21.0.2 → 17.0.21.0), which is enough to check it against the manifest. The output still shows the full 17.0.21.0.2.
  • Unreadable versions: a javac whose version can't be read is listed as <path>/javac (version not recognized) instead of being dropped.
  • Failure message: "OpenJDK 17 is missing" now only appears when no javac was 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 --json reports it.

Tests

OpenJdkCheckupTests:

  • Reading javac 17.0.16, 17.0.20.1 and 17.0.21.0.2.
  • 17.0.21.0.2 meets 17.0.19 and sorts above 17.0.20.1.
  • Output with no version in it.
  • Failure messages: no javac found, a JDK that is too old, a javac whose version can't be read, an exact required version, and the --json message.

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 GlobalUnoCheckVersion and revert the msopenjdk-17=17.0.20.1-1 pin from unoplatform/uno#25680.

@ajpinedam ajpinedam self-assigned this Oct 26, 2026
@mergify

mergify Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

This pull request is merged.

@ajpinedam
ajpinedam force-pushed the dev/ap/590-openjdk-five-part-version branch from 7fd2e04 to 4a617e5 Compare November 11, 2026 06:29

@Xiaoy312 Xiaoy312 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

@agneszitte
agneszitte merged commit 3d07bb9 into main Nov 11, 2026
61 checks passed
@agneszitte
agneszitte deleted the dev/ap/590-openjdk-five-part-version branch November 11, 2026 20:21
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.

OpenJDK checkup drops JDKs with a five-part version (msopenjdk 17.0.21.0.2)

3 participants