Skip to content

Commit 703d680

Browse files
redsun82Copilot
andcommitted
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>
1 parent cf26b00 commit 703d680

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • java/ql/integration-tests/java/gradle-sample-without-wrapper-or-gradle-buildless

java/ql/integration-tests/java/gradle-sample-without-wrapper-or-gradle-buildless/test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
# The version of gradle used doesn't work on java 17
77
def test(codeql, use_java_11, java, environment, check_diagnostics):
88
check_diagnostics.redact += ["attributes.java_vendor"]
9-
check_diagnostics.replacements = [("11\\.[0-9]+\\.[0-9]+", "11")]
9+
# the JDK build provided by the CI runner image may report any number of version components
10+
# (e.g. `11.0.32` or `11.0.32.1`), so keep only the feature version
11+
check_diagnostics.replacements = [(r'"11(\.[0-9]+)+"', '"11"')]
1012
gradle_override_dir = pathlib.Path(tempfile.mkdtemp())
1113
if runs_on.windows:
1214
(gradle_override_dir / "gradle.bat").write_text("@echo off\nexit /b 2\n")

0 commit comments

Comments
 (0)