Details
Description
The invalid result appears only in 2.0.0 version of Groovy:
dm@dmc:~/bin/groovy-2.0.0/bin> ./groovysh
Groovy Shell (2.0.0, JVM: 1.6.0_29)
Type 'help' or '\h' for help.
---------------------------------------------
groovy:000> def c =
; c(z: 0, y: 2, x: 3)
===> false
groovy:000>
In Groovy 1.8.6 the result is correct.
dm@dmc:~/bin/groovy-1.8.6/bin> ./groovysh
Groovy Shell (1.8.6, JVM: 1.6.0_29)
Type 'help' or '\h' for help.
----------------------------------------------
groovy:000> def c =
; c(z: 0, y: 2, x: 3)
===> null
groovy:000>
It can be fixed by replacing the ternary operator with 'else if' and 'else'.