Hi Devs,

I've posted a question about the topic here:
https://stackoverflow.com/questions/76863969/elvis-operator-and-type-casting-precedence-in-groovy/76900266#76900266

Just repeating the same here and I'm curious about your opinion. Should I
open a bug ticket for this as suggested in the answer in SOF?

---

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


---


Regards,

Ferenc

Reply via email to