I was observing the following behavior:
This works:
node("master") { testMethod(null, new Object()) } def testMethod(myparameter,mysecondparameter) { echo "test" }
This fails:
node("master") { testMethod(null) } def testMethod(myparameter) { echo "test" }
I was expecting that it should be possible to pass in a single parameter with a null value.
- duplicates
-
JENKINS-32062 Arrays may not be passed directly to methods
-
- Resolved
-
Groovy apparently thinks it is a good idea to pass null rather than [null], which the CPS engine was not expecting. I think this is a varargs issue: null is ambiguous in Java, too, if you have a varargs method, and everything in Groovy is pretty loose and undocumented.