From 18598d6169e2455291f52028f563cb7153c15bd6 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Fri, 11 Aug 2023 12:21:24 -0700 Subject: [PATCH] [JENKINS-71808] `GenericWhitelistTest#sanity` fails on Java 21 --- .../sandbox/whitelists/StaticWhitelistTest.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/jenkinsci/plugins/scriptsecurity/sandbox/whitelists/StaticWhitelistTest.java b/src/test/java/org/jenkinsci/plugins/scriptsecurity/sandbox/whitelists/StaticWhitelistTest.java index b10d2c63f..b32b8728e 100644 --- a/src/test/java/org/jenkinsci/plugins/scriptsecurity/sandbox/whitelists/StaticWhitelistTest.java +++ b/src/test/java/org/jenkinsci/plugins/scriptsecurity/sandbox/whitelists/StaticWhitelistTest.java @@ -40,6 +40,7 @@ import java.util.List; import java.util.Random; import java.util.Set; +import java.util.regex.Matcher; import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.EnumeratingWhitelist.MethodSignature; import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.EnumeratingWhitelist.Signature; @@ -140,7 +141,11 @@ static void sanity(URL definition) throws Exception { new MethodSignature("java.util.random.RandomGenerator", "nextGaussian"), new MethodSignature("java.util.random.RandomGenerator", "nextInt"), new MethodSignature("java.util.random.RandomGenerator", "nextInt", "int"), - new MethodSignature("java.util.random.RandomGenerator", "nextLong") + new MethodSignature("java.util.random.RandomGenerator", "nextLong"), + // Override the corresponding MatchResult methods in Java 20+. + new MethodSignature(Matcher.class, "end", String.class), + new MethodSignature(Matcher.class, "group", String.class), + new MethodSignature(Matcher.class, "start", String.class) )); @Test public void sanity() throws Exception {