eric-milles opened a new pull request #1687: URL: https://github.com/apache/groovy/pull/1687
For default values, I want to use `map.containsKey(name) ? map.name : defaultValue` instead of `map.name ?: defaultValue` -- in case `null` or `0` or another falsy value is supplied. This change does not give the map a chance to supply a default value, but I thought that was okay in order to allow user to supply falsy value explicitly. One case that was hard to understand comes form the `record` tests. The example has `null` passed for an `int` and results in `0` whereas this code produces a cast exception. I wanted to understand if that was desired or just a happy accident. ```groovy assert new ColoredPoint(x: 0, y: null).toString() == 'ColoredPoint[x=0, y=0, color=white]' ``` A null test could be inserted for primitives, but it would be more complex and would probably mean one of the operands was evaluated twice. Probably not a huge concern, but I thought I would meantion it. https://issues.apache.org/jira/browse/GROOVY-10497 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
