(a) x ?: 0
(b) foo?.plus(bar)

Jason Winnebeck

-----Original Message-----
From: o...@ocs.cz [mailto:o...@ocs.cz] 
Sent: Sunday, February 19, 2017 8:38 AM
To: users@groovy.apache.org
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 expression?

Thanks,
OC

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.

Reply via email to