Let's take the following simple expression:
((Double) null ?: 0).getClass()
Results:
- Groovy 3:
class java.lang.Double
- Groovy 4:
class java.lang.Integer
Does anyone know the reason for the different behaviour? I'd say Groovy 4 is correct since the casting is applied before the Elvis operator.
Checked, but couldn't find anything related in the Groovy 4 release notes: https://groovy-lang.org/releasenotes/groovy-4.0.html