jenkinsci/groovy-sandbox

Array-valued argument incorrectly inlined

jglick opened this issue · 1 comments

I have a class (actually a custom Script subclass used as a base class) which defines a method with two overloads, one of them taking Iterable, the other taking Object[]. (Irritating that Object[] does not implement Iterable in Java 5, but oh well.) Then I have a Groovy script which receives an array-valued variable in its Binding (the array component type is more specific than Object, in case it matters), and calls the method, which without the sandbox installed correctly resolves to the overload taking Object[].

When I run the script with the sandbox, onMethodCall is called with the right receiver and method, but args is the actual array (with, say, two elements). I would expect it to be a one-element array whose element at index 0 was an array.

This bug makes it tricky to write a GroovyInterceptor which correctly matches up calls with a whitelist of specific method signatures.

Fixed toward 1.3