JetGroovy Disagrees with Groovy Compiler About Syntax Error

Hi,

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.

To wit:


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.


Randall Schulz

3 comments

Randall,
we are unable to reproduce it here. Could we please have a self-contained testcase to reproduce?

Eugene.

0

You managed to reproduce it?

I'm sorry I didn't supply a test case, but with the work-around so simple, the task of concocting an isolated example seemed a bit too much.

Thanks for your diligence.

Randall Schulz

0

Please sign in to leave a comment.