Cross-posting to the mailing list from Slack
<https://groovy-community.slack.com/archives/C2NEFCM55/p1750110654202509>.

I'm trying to debug an issue with the static type checker and closure
method parameters. It seems like in Groovy 4.0.19, something changed that
has broken type checking for statements like:

cfValues['SpecialKey']*.name.collect {it.toUpperCase()}

Some context: cfValues is a binding variable that I provide custom type
information for via a ClassCodeExpressionTransformer.

In this case, the static type checker seems to know that
cfValues['SpecialKey'] returns a value of the expected type which, in turn,
has a name property that is a String. Statements like:

cfValues['SpecialKey']*.name*.toUpperCase()

compile just fine. But from Groovy 4.0.19 onward, the static type checker
only seems to think that the it Closure parameter is an Object, not a
String. I've been poring over the diff, the changelog
<https://groovy-lang.org/changelogs/changelog-4.0.19.html>, and stepping
through the debugger to figure out what changed, but I haven't been able to
fathom it out. Does this ring a bell for anyone?

Thanks for any pointers.

Best,

Jonny Carter

Reply via email to