Affects Version/s: 1.6, 1.6.1, 1.6.2, 1.6.3, 2.4.0-beta-4
Fix Version/s: None
The null-safe deref operator causes compiler errors if it is used with the subscript operator.
Take the following example:
This is fine. However if you want to use the subscript operator for property access:
You get errors. Of course you can workaround this with:
But this is quite ugly if you are in a situation where you need/want to use subscript, and also if this is done properly then we also get nullsafe deref of arrays, lists and sets, especially if they are nested:
Without this you have to write the equivalent of:
Can't Groovy do this for us?