-
Bug
-
Resolution: Unresolved
-
Minor
-
Ubuntu 16.04.3 64bit
OpenJDK 1.8.0_151
Jenkins 2.89.4
Pipeline:Groovy 2.48
Since upgrading to Pipeline:Groovy 2.48, the .empty property of List objects gives very strange results, whose boolean value in particular is the reverse of the expected.
When executing the following script as a pipeline (testet via "Replay" and replacing the existing script by this) gives weird output:
Script
x = [] as List
println x
println x.isEmpty()
println x.empty
x<<"hello"
println x
println x.isEmpty()
println x.empty
Expected output
[Pipeline] echo [] [Pipeline] echo true [Pipeline] echo true [Pipeline] echo [hello] [Pipeline] echo false [Pipeline] echo false [Pipeline] End of Pipeline
Actual output
[Pipeline] echo [] [Pipeline] echo true [Pipeline] echo [] [Pipeline] echo [hello] [Pipeline] echo false [Pipeline] echo [false] [Pipeline] End of Pipeline
Downgrading the Pipeline:Groovy plugin to 2.47 fixes it; after upgrading again, the weird behaviour is back.
Workaround
For the moment, I can live with calling isEmpty() instead of accessing empty.
further considerations
I have not tested whether any other properties besides .empty are affected.