[JIRA] (JENKINS-56758) Varargs not supported in shared pipeline method signatures

2019-04-19 Thread jerrywil...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 jerry wiltse edited a comment on  JENKINS-56758  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Varargs not supported in shared pipeline method signatures   
 

  
 
 
 
 

 
 I just spent a few hours figuring out the same thing.  This one was tricky to diagnose.  Of note, I found a different workaround.  You can keep the varargs signature if the caller forces the args to be an ArrayList with brackets. So, in your example, caller can do this: {code:java}testUtils("${s}", ["${t1}", "${t2}"]){code} Or caller can just create a regular string.  Both of the workarounds have undesired side-effects IMO. Hope it get fixed properly.   
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

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

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] (JENKINS-56758) Varargs not supported in shared pipeline method signatures

2019-04-19 Thread jerrywil...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 jerry wiltse commented on  JENKINS-56758  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Varargs not supported in shared pipeline method signatures   
 

  
 
 
 
 

 
 I just spent a few hours figuring out the same thing.  This one was tricky to diagnose.  Of note, I found a different workaround.  You can keep the varargs signature if the caller forces the args to be an ArrayList with brackets.  So, in your example, caller can do this:  

 

testUtils("${s}", ["${t1}", "${t2}"]) 

 Both of the workarounds have undesired side-effects IMO. Hope it get fixed properly.   
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

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

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] (JENKINS-56758) Varargs not supported in shared pipeline method signatures

2019-03-26 Thread robin.sm...@forgerock.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Robin Smith created an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Jenkins /  JENKINS-56758  
 
 
  Varargs not supported in shared pipeline method signatures   
 

  
 
 
 
 

 
Issue Type: 
  Bug  
 
 
Assignee: 
 Andrew Bayer  
 
 
Components: 
 pipeline, script-security-plugin, workflow-cps-plugin  
 
 
Created: 
 2019-03-26 12:31  
 
 
Environment: 
 Jenkins:2.150.3  workflow-cps:2.65  script-security:1.56  
 
 
Priority: 
  Minor  
 
 
Reporter: 
 Robin Smith  
 

  
 
 
 
 

 
 When calling a variadic shared pipeline method, the method signature is not recognised when GStrings are used - it seems they are not being coerced to Strings correctly. I have some simple shared libraries to demonstrate the issue: 

 

// vars/testUtils.groovy
void call(String source, String... targets) {
echo "testUtils ${source} ${targets.join(' ')}"
}
 

 

 

// vars/testUtilsListMethods.groovy
void call(String source, Collection targets) {
echo "testUtilsListMethods ${source} ${targets.join(' ')}"
}
 

 And a pipeline script: 

 

// load library with @Library(...) _
def s  = 'source'
def t1 = 'target1'
def t2 = 'target2'