You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by Maarten Boekhold <bo...@gmx.com> on 2015/10/28 09:43:59 UTC
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
RE: JsonBuilder and all-caps field names
Posted by Rahul Somasunderam <rs...@transcendinsights.com>.
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.
RE: JsonBuilder and all-caps field names
Posted by Rahul Somasunderam <rs...@transcendinsights.com>.
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.