Description
Unable to use the default hashmap constructor (Syntaxt : new Person(name:"Martin", firstName:"John") ).
This script show differrent result in groovy (JSR-06) from XWiki.
The script:
class Person
{ def Personne(pName, pFN, pAge, pFeet, pOld) { name = pName firstname = pFN age = pAge old = pOld } String name
String firstname
int age
int feet
int old
}
mytable=[new Person(name:"Georges",firstname:"Arthur",age:34,feet:2,old:4),
new Person(name:"Schputz",firstname:"Lolo",age:32,feet:2,old:4),
new Person(name:"Moran",firstname:"Marcel",age:11,feet:3,old:5),
new Person(name:"Flutor",firstname:"Jacques",age:23,feet:2,old:8)];
println mytable.size() //
for ( myi in mytable)
{
println myi.firstname
}
Result in grooyv
4
Arthur
Lolo
Marcel
Jacques
Result in XWiki
4 null null null null
I can get around by using an explicit constructor, but its quite verbose.