From 240741ecb6a581a541f3c5eee492ba721afc57bc Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Thu, 3 Sep 2026 15:29:55 +0200 Subject: [PATCH] Java: make JDK 11 version normalisation in gradle buildless test robust `java.version` may carry a fourth `$PATCH` component (JEP 322), as in Temurin `jdk-11.0.32.1+1`. The previous pattern matched exactly three components, so the trailing `.1` survived and the test reported `11.1`. Accept any number of version components, and anchor on the surrounding quotes so the substitution only rewrites a whole JSON string rather than version-like text elsewhere in the diagnostics. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../gradle-sample-without-wrapper-or-gradle-buildless/test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/java/ql/integration-tests/java/gradle-sample-without-wrapper-or-gradle-buildless/test.py b/java/ql/integration-tests/java/gradle-sample-without-wrapper-or-gradle-buildless/test.py index 3aaee01f4055..a312878e107f 100644 --- a/java/ql/integration-tests/java/gradle-sample-without-wrapper-or-gradle-buildless/test.py +++ b/java/ql/integration-tests/java/gradle-sample-without-wrapper-or-gradle-buildless/test.py @@ -6,7 +6,9 @@ # The version of gradle used doesn't work on java 17 def test(codeql, use_java_11, java, environment, check_diagnostics): check_diagnostics.redact += ["attributes.java_vendor"] - check_diagnostics.replacements = [("11\\.[0-9]+\\.[0-9]+", "11")] + # the JDK build provided by the CI runner image may report any number of version components + # (e.g. `11.0.32` or `11.0.32.1`), so keep only the feature version + check_diagnostics.replacements = [(r'"11(\.[0-9]+)+"', '"11"')] gradle_override_dir = pathlib.Path(tempfile.mkdtemp()) if runs_on.windows: (gradle_override_dir / "gradle.bat").write_text("@echo off\nexit /b 2\n")