Skip to content

Commit

Permalink
Merge pull request #562 from ckullabosch/patch-1
Browse files Browse the repository at this point in the history
[JENKINS-72975] Permit java.util.regex.MatchResult.group(String)
  • Loading branch information
dwnusbaum authored Apr 8, 2024
2 parents 1399a91 + 75aeede commit f07d9ce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -790,11 +790,16 @@ method java.util.random.RandomGenerator nextInt int
method java.util.random.RandomGenerator nextLong
method java.util.regex.MatchResult end
method java.util.regex.MatchResult end int
method java.util.regex.MatchResult end java.lang.String
method java.util.regex.MatchResult group
method java.util.regex.MatchResult group int
method java.util.regex.MatchResult group java.lang.String
method java.util.regex.MatchResult groupCount
method java.util.regex.MatchResult hasMatch
method java.util.regex.MatchResult namedGroups
method java.util.regex.MatchResult start
method java.util.regex.MatchResult start int
method java.util.regex.MatchResult start java.lang.String
method java.util.regex.Matcher appendReplacement java.lang.StringBuffer java.lang.String
method java.util.regex.Matcher appendTail java.lang.StringBuffer
method java.util.regex.Matcher end java.lang.String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.util.Random;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.MatchResult;

import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.EnumeratingWhitelist.MethodSignature;
import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.EnumeratingWhitelist.Signature;
Expand Down Expand Up @@ -145,7 +146,13 @@ static void sanity(URL definition) throws Exception {
// 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)
new MethodSignature(Matcher.class, "start", String.class),
// Do not exist until Java 20.
new MethodSignature(MatchResult.class, "end", String.class),
new MethodSignature(MatchResult.class, "group", String.class),
new MethodSignature(MatchResult.class, "hasMatch"),
new MethodSignature(MatchResult.class, "namedGroups"),
new MethodSignature(MatchResult.class, "start", String.class)
));

@Test public void sanity() throws Exception {
Expand Down

0 comments on commit f07d9ce

Please sign in to comment.