I'm guessing it is "gpath.@id" not "this.@id" that throws the exception. There
have been some changes to help with private method access. It is unclear
without some additional tracing just where the attribute syntax falls down.
I don't quite know enough about GPathResult to know if
"gpath.getAttribute('id')" or "gpath.getProperty('@id')" is the equivalent of
"gpath.@id".
________________________________
From: Mattias Reichel <[email protected]>
Sent: Thursday, May 15, 2025 3:13 AM
To: [email protected] <[email protected]>
Subject: [EXT] GPathResult breakage in Groovy 5
External Email: Use caution with links and attachments.
When trying out Groovy 5 on the Grails codebase I am getting the following
runtime error:
groovy.lang.MissingFieldException: No such field: id for class:
groovy.xml.slurpersupport.NodeChild
at
org.grails.databinding.xml.GPathResultMap.<init>(GPathResultMap.groovy:35)
at org.grails.databinding.xml.GPathResultMapSpec.Test nested
elements(GPathResultMapSpec.groovy:44)
class GPathResultMap implements Map {
protected GPathResult gpath
protected id
GPathResultMap(GPathResult gpath) {
this.gpath = gpath
this.@id = [email protected]() ?: null // <-- This is the offending line
}
There is no id attribute on the GPathResult root:
<person>
<name>John Doe</name>
<locations>
<location>
<shippingAddress>foo</shippingAddress>
<billingAddress>bar</billingAddress>
</location>
<location>
<shippingAddress>foo2</shippingAddress>
<billingAddress>bar2</billingAddress>
</location>
</locations>
</person>
Is this expected behavior, and we need to update our logic, or is it an issue
that needs addressing in Groovy?
Thanks
Mattias