Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Information Provided
-
2.4.18
-
None
-
None
Description
Why ternary operator in properties works incorrectly with strings?
class Parent { def String name = (name == null || name == 'somebadname') ? 'default' : name } a = new Parent() println("name is: ${a.name}") b = new Parent(name: 'somebadname') println("name is: ${b.name}") c = new Parent(name: 'other') println("name is: ${c.name}")
output:
name is: default
name is: somebadname
name is: other