As I've been groping through the darkness in trying to get a properly formulated JSON builder in one of my Grails controller actions, I discovered that there's a construct that elicits an error (red) from JetGroovy: "Inner methods are not supported".
In this particualr case, I'm emitting an array of maps, so I have a loop that iterates once for each member of that array to be emitted. It computes several values and then builds and emits the Map to be emitted as a JSON object.
However, I discovered that the inner symbol "values" (not the outer string 'values') could be anything and the correct JSON would be produced. I figured that since the name used here didn't matter, I'd just use an underscore:
Then I had to elaborate the precise set of keys included in each JSON object in the array, so I built a Map separately with some keys always included and some added only conditionally. Once it's fully constituted, I emit it:
In the latter case, using the underscore (or any symbol that starts with an underscore) causes JetGroovy to give the "Inner methods are not supported" error. Any other symbol can be used without complaint.
If I ignore JetGroovy's error indication and run the Grails application, it works as intended.