[JIRA] (JENKINS-50791) Got "Ambiguous method overloading" for trampoline()

2018-04-17 Thread lch...@hotmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Hubert Li edited a comment on  JENKINS-50791  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Got "Ambiguous method overloading" for trampoline()   
 

  
 
 
 
 

 
 Thanks Andrew, this way works, but print: groovy.lang.TrampolineClosure@24923393So I updated it:{code:java}@NonCPSdef factorial(int factorialFor) {def tailFactorialtailFactorial = { int number, BigInteger theFactorial = 1 ->number == 1 ? theFactorial :tailFactorial.trampoline(number - 1, number * (theFactorial ?: 1))}.trampoline()tailFactorial(factorialFor)}println "factorial of 5 is ${factorial(5)}"println "Number of bits in the result is ${factorial(5000).bitCount()}"{code}This version works fine, but it  does  not print outputs one by one, but print all after execution. <
 /td> 
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)  
 
 

 
   
 

  
 

  
 

   





-- 
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-50791) Got "Ambiguous method overloading" for trampoline()

2018-04-17 Thread lch...@hotmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Hubert Li resolved as Fixed  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Jenkins /  JENKINS-50791  
 
 
  Got "Ambiguous method overloading" for trampoline()   
 

  
 
 
 
 

 
Change By: 
 Hubert Li  
 
 
Status: 
 Open Resolved  
 
 
Resolution: 
 Fixed  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)  
 
 

 
   
 

  
 

  
 

   





-- 
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-50791) Got "Ambiguous method overloading" for trampoline()

2018-04-17 Thread lch...@hotmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Hubert Li commented on  JENKINS-50791  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Got "Ambiguous method overloading" for trampoline()   
 

  
 
 
 
 

 
 Thanks Andrew, this way works, but print: groovy.lang.TrampolineClosure@24923393 So I updated it: 

 

@NonCPS
def factorial(int factorialFor) {
def tailFactorial
tailFactorial = { int number, BigInteger theFactorial = 1 ->
number == 1 ? theFactorial :
tailFactorial.trampoline(number - 1, number * (theFactorial ?: 1))
}.trampoline()
tailFactorial(factorialFor)
}
println "factorial of 5 is ${factorial(5)}"
println "Number of bits in the result is ${factorial(5000).bitCount()}" 

 This version works fine, but it not print outputs one by one, but print all after execution.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)  
 
 

 
   
 

  
 

  
 

   





-- 
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-50791) Got "Ambiguous method overloading" for trampoline()

2018-04-16 Thread andrew.ba...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Andrew Bayer commented on  JENKINS-50791  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Got "Ambiguous method overloading" for trampoline()   
 

  
 
 
 
 

 
 So the problem here, at least initially, isn't the trampolining - it's ambiguity on types. I found this, which suggested changing from number * theFactorial to number * (theFactorial ?: 1), at which point the error went away. But! TrampolineClosure isn't going to work in CPS Pipeline code in general - pretty much anything that nests a Closure#call invocation inside a class that's defined outside of the Pipeline code (i.e., TrampolineClosure and its calls to original.call(...) is going to result in confusion. This'll work fine in a @NonCPS-annotated method, though.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)  
 
 

 
   
 

  
 

  
 

   





-- 
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-50791) Got "Ambiguous method overloading" for trampoline()

2018-04-16 Thread andrew.ba...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Andrew Bayer updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Jenkins /  JENKINS-50791  
 
 
  Got "Ambiguous method overloading" for trampoline()   
 

  
 
 
 
 

 
Change By: 
 Andrew Bayer  
 
 
Component/s: 
 workflow-cps-plugin  
 
 
Component/s: 
 pipeline  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)  
 
 

 
   
 

  
 

  
 

   





-- 
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-50791) Got "Ambiguous method overloading" for trampoline()

2018-04-13 Thread lch...@hotmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Hubert Li moved an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Jenkins /  JENKINS-50791  
 
 
  Got "Ambiguous method overloading" for trampoline()   
 

  
 
 
 
 

 
Change By: 
 Hubert Li  
 
 
Project: 
 Infrastructure Jenkins  
 
 
Key: 
 INFRA JENKINS - 1576 50791  
 
 
Workflow: 
 classic default workflow JNJira + In-Review  
 
 
Component/s: 
 pipeline  
 
 
Component/s: 
 core  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you a