Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-72975] Permit java.util.regex.MatchResult.group(String) #562

Merged
merged 4 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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