Skip to content
Open
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 @@ -1166,6 +1166,13 @@ staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods putAll java.util.M
staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods putAt java.util.List int java.lang.Object
staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods putAt java.util.Map java.lang.Object java.lang.Object
staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods removeAll java.util.Collection groovy.lang.Closure
staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods replaceFirst java.lang.CharSequence java.lang.CharSequence groovy.lang.Closure
staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods replaceFirst java.lang.CharSequence java.lang.CharSequence java.lang.CharSequence
staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods replaceFirst java.lang.CharSequence java.util.regex.Pattern groovy.lang.Closure
staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods replaceFirst java.lang.CharSequence java.util.regex.Pattern java.lang.CharSequence
staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods replaceFirst java.lang.String java.lang.String groovy.lang.Closure
staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods replaceFirst java.lang.String java.util.regex.Pattern groovy.lang.Closure
staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods replaceFirst java.lang.String java.util.regex.Pattern java.lang.String
staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods retainAll java.util.Collection groovy.lang.Closure
staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods reverse java.util.Iterator
staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods reverse java.util.List
Expand Down Expand Up @@ -1383,9 +1390,12 @@ staticMethod org.codehaus.groovy.runtime.StringGroovyMethods replaceAll java.lan
staticMethod org.codehaus.groovy.runtime.StringGroovyMethods replaceAll java.lang.String java.util.regex.Pattern groovy.lang.Closure
staticMethod org.codehaus.groovy.runtime.StringGroovyMethods replaceAll java.lang.String java.util.regex.Pattern java.lang.String
staticMethod org.codehaus.groovy.runtime.StringGroovyMethods replaceFirst java.lang.CharSequence java.lang.CharSequence groovy.lang.Closure
staticMethod org.codehaus.groovy.runtime.StringGroovyMethods replaceFirst java.lang.CharSequence java.lang.CharSequence java.lang.CharSequence
staticMethod org.codehaus.groovy.runtime.StringGroovyMethods replaceFirst java.lang.CharSequence java.util.regex.Pattern groovy.lang.Closure
staticMethod org.codehaus.groovy.runtime.StringGroovyMethods replaceFirst java.lang.CharSequence java.util.regex.Pattern java.lang.CharSequence
staticMethod org.codehaus.groovy.runtime.StringGroovyMethods replaceFirst java.lang.String java.lang.String groovy.lang.Closure
staticMethod org.codehaus.groovy.runtime.StringGroovyMethods replaceFirst java.lang.String java.util.regex.Pattern groovy.lang.Closure
staticMethod org.codehaus.groovy.runtime.StringGroovyMethods replaceFirst java.lang.String java.util.regex.Pattern java.lang.String
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/apache/groovy/blob/41b990d0a20e442f29247f0e04cbed900f3dcad4/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L2730 This overload is deprecated. (May be true of others, I did not check yet.) Does the sandbox actually check this one specifically when you write e.g.

'xxx'.replaceFirst(/x/, 'y')

or would it use the CharSequence overload? Could check in e.g.

even if the result is not committed.

Copy link
Author

@ugrave ugrave Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes i also saw it that the string is depreicated. But in my test is using the string overload and not the CharSequence overload.

I did a test with all replaceFirst whiliste removed for String, StringGroovyMethods and DefaultGroovyMethods
An get different results depending of the replaceFirst is used:

  • 'xxx'.replaceFirst(/x/, 'y'): Scripts not permitted to use method java.lang.String replaceFirst java.lang.String java.lang.String
  • 'xxx'.replaceFirst(~/x/, 'y'): Scripts not permitted to use staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods replaceFirst java.lang.String java.util.regex.Pattern java.lang.String

Nut sure when this StringGroovyMethod is used. In my case its using always the DefaultGroovyMethods or from String itself. (maybe because String itself has also now a replaceFirst method)

staticMethod org.codehaus.groovy.runtime.StringGroovyMethods reverse java.lang.String
staticMethod org.codehaus.groovy.runtime.StringGroovyMethods startsWithAny java.lang.CharSequence java.lang.CharSequence[]
staticMethod org.codehaus.groovy.runtime.StringGroovyMethods takeWhile groovy.lang.GString groovy.lang.Closure
Expand Down
Loading