groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rahul Somasunderam <rsomasunde...@transcendinsights.com>
Subject RE: JsonBuilder and all-caps field names
Date Sun, 06 Dec 2015 04:26:21 GMT
This does look a lot like https://issues.apache.org/jira/browse/GROOVY-7012
________________________________
From: Rahul Somasunderam [rsomasunderam@transcendinsights.com]
Sent: Saturday, December 05, 2015 6:27 PM
To: users@groovy.incubator.apache.org
Subject: RE: JsonBuilder and all-caps field names

I got this to work

builder {
    HEADER {
        'FIELD' 'value'
    }
}

This one works too:

builder {
    HEADER {
        FIELD {
            'FIELD' 'value'
        }
        Field {
            field 'value'
        }
    }
}

It would appear that the methodMissing has some trouble when the missing method starts with
capitals and gets a non closure argument. I would recommends opening a bug.

R.
rahul

________________________________
From: Maarten Boekhold [boekhold@gmx.com]
Sent: Wednesday, October 28, 2015 1:43 AM
To: users@groovy.incubator.apache.org
Subject: JsonBuilder and all-caps field names

Hi,

the following works:

def builder = new JsonBuilder()
builder {
    HEADER {
        field 'value'
    }
}

But the following gives me a compile error:

def builder = new JsonBuilder()
builder {
    HEADER {
        FIELD 'value'
    }
}

"Groovyc: unexpected token: value"

Why is that? groovy 2.4.4 btw.

Maarten



The information transmitted is intended only for the person or entity to which it is addressed
and may contain CONFIDENTIAL material. If you receive this material/information in error,
please contact the sender and delete or destroy the material/information.

The information transmitted is intended only for the person or entity to which it is addressed
and may contain CONFIDENTIAL material.  If you receive this material/information in error,
please contact the sender and delete or destroy the material/information.
Mime
View raw message