groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Winnebeck, Jason" <>
Subject RE: improve null-handling
Date Mon, 20 Feb 2017 13:42:08 GMT
(a) x ?: 0
(b) foo?.plus(bar)

Jason Winnebeck

-----Original Message-----
From: [] 
Sent: Sunday, February 19, 2017 8:38 AM
Subject: improve null-handling

Hi there,

is there a way to make sure in Groovy

(a) that instead of "Cannot cast object 'null' with class 'null' to class 'XXX'" for numeric
primitive types XXX (like int) one gets simply a XXX containing 0
(b) that instead of "Cannot resolve which method to invoke for [null] due to overlapping prototypes"
(which happens e.g., with foo+bar if foo is null) one gets simply null as a result of the


This email message and any attachments are for the sole use of the intended recipient(s).
Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the
intended recipient, please contact the sender by reply email and destroy all copies of the
original message and any attachments.

View raw message