[JIRA] (JENKINS-58611) Implement method comparison for var-args

15 views
Skip to first unread message

akram.benaissi@gmail.com (JIRA)

unread,
Jul 23, 2019, 3:56:03 AM7/23/19
to jenkinsc...@googlegroups.com
Akram Ben Aissi updated an issue
 
Jenkins / Improvement JENKINS-58611
Implement method comparison for var-args
Change By: Akram Ben Aissi
Hi,

our custom DSL for Groovy contains 2 methods named the same way, but with a different number of arguments:

myMethod(boolean watch, String...args)

myMethod(String...args)

 

While trying to call the method from a pipeline, I got the following exception:

```  
{code:java}
java.lang.IllegalStateException: cannot compare public com.openshift.jenkins.plugins.OpenShiftDSL$Result com.openshift.jenkins.plugins.OpenShiftDSL.exec(java.lang.Object[]) to public com.openshift.jenkins.plugins.OpenShiftDSL$Result com.openshift.jenkins.plugins.OpenShiftDSL.exec(boolean,java.lang.Object[])
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovyCallSiteSelector.isMoreSpecific(GroovyCallSiteSelector.java:291)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovyCallSiteSelector.findMatchingMethod(GroovyCallSiteSelector.java:203)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovyCallSiteSelector.method(GroovyCallSiteSelector.java:150)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:90)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:156)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:160)
at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
at WorkflowScript.run(WorkflowScript:13)
at com.openshift.jenkins.plugins.OpenShiftDSL.withProject(jar:file:/var/lib/jenkins/plugins/openshift-client/WEB-INF/lib/openshift-client.jar!/com/openshift/jenkins/plugins/OpenShiftDSL.groovy:395)
{code}
 
```

 

 

It seems that this is due to an incomplete implementation of the method comparison in GroovyCallSiteSelector class. A TODO is still present in the code at the following line:

[https://github.com/jenkinsci/script-security-plugin/blob/master/src/main/java/org/jenkinsci/plugins/scriptsecurity/sandbox/groovy/GroovyCallSiteSelector.java#L289]

 

 

 

 

 

 
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

akram.benaissi@gmail.com (JIRA)

unread,
Jul 23, 2019, 3:56:03 AM7/23/19
to jenkinsc...@googlegroups.com
Akram Ben Aissi created an issue
Issue Type: Improvement Improvement
Assignee: Andrew Bayer
Components: script-security-plugin
Created: 2019-07-23 07:55
Priority: Minor Minor
Reporter: Akram Ben Aissi

Hi,

our custom DSL for Groovy contains 2 methods named the same way, but with a different number of arguments:

myMethod(boolean watch, String...args)

myMethod(String...args)

 

While trying to call the method from a pipeline, I got the following exception:

```

java.lang.IllegalStateException: cannot compare public com.openshift.jenkins.plugins.OpenShiftDSL$Result com.openshift.jenkins.plugins.OpenShiftDSL.exec(java.lang.Object[]) to public com.openshift.jenkins.plugins.OpenShiftDSL$Result com.openshift.jenkins.plugins.OpenShiftDSL.exec(boolean,java.lang.Object[])


at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovyCallSiteSelector.isMoreSpecific(GroovyCallSiteSelector.java:291)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovyCallSiteSelector.findMatchingMethod(GroovyCallSiteSelector.java:203)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovyCallSiteSelector.method(GroovyCallSiteSelector.java:150)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:90)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:156)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:160)
at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
at WorkflowScript.run(WorkflowScript:13)
at com.openshift.jenkins.plugins.OpenShiftDSL.withProject(jar:file:/var/lib/jenkins/plugins/openshift-client/WEB-INF/lib/openshift-client.jar!/com/openshift/jenkins/plugins/OpenShiftDSL.groovy:395)

```

 

 

It seems that this is due to an incomplete implementation of the method comparison in GroovyCallSiteSelector class. A TODO is still present in the code at the following line:

https://github.com/jenkinsci/script-security-plugin/blob/master/src/main/java/org/jenkinsci/plugins/scriptsecurity/sandbox/groovy/GroovyCallSiteSelector.java#L289

 

 

 

 

 

 

akram.benaissi@gmail.com (JIRA)

unread,
Jul 23, 2019, 3:57:02 AM7/23/19
to jenkinsc...@googlegroups.com
Akram Ben Aissi updated an issue
 
Jenkins / Bug JENKINS-58611
Change By: Akram Ben Aissi
Issue Type: Improvement Bug

akram.benaissi@gmail.com (JIRA)

unread,
Jul 23, 2019, 5:58:02 AM7/23/19
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages