[JIRA] (JENKINS-60636) Using method pointers results in warning

9 views
Skip to first unread message

bruce.brouwer@gmail.com (JIRA)

unread,
Jan 3, 2020, 5:22:02 PM1/3/20
to jenkinsc...@googlegroups.com
Bruce Brouwer created an issue
 
Jenkins / Bug JENKINS-60636
Using method pointers results in warning
Issue Type: Bug Bug
Assignee: Unassigned
Components: workflow-cps-plugin
Created: 2020-01-03 22:21
Priority: Minor Minor
Reporter: Bruce Brouwer

When invoking a closure created from a method pointer, the following warning is printed in the log:

expected to call org.codehaus.groovy.runtime.MethodClosure.call but wound up catching my.method; see:
https://jenkins.io/redirect/pipeline-cps-method-mismatches/ 

The code works correctly, but produces this warning:

def method() {
  // do stuff
}
def runIt(Closure closure) {
  closure.call()
}
runIt(this.&method)

The workaround gets rid of the warning:

def method() {
  // do stuff
}
def runIt(Closure closure) {
  closure.call()
}
runIt({ method() }) 

I would prefer to not have to create this extra closure.

My situation is a little more complex than this as the method is from another vars script, but it should be the same situation.

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

bruce.brouwer@gmail.com (JIRA)

unread,
Jan 3, 2020, 5:25:02 PM1/3/20
to jenkinsc...@googlegroups.com
Bruce Brouwer updated Bug JENKINS-60636
 

Sorry, didn't see the previous issue in my search. 

Change By: Bruce Brouwer
Status: Open Fixed but Unreleased
Resolution: Duplicate

bruce.brouwer@gmail.com (JIRA)

unread,
Jan 3, 2020, 5:25:02 PM1/3/20
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages