In Groovy, I have a parent class and a child class where the parent class\'s constructor tries setting the value of a field of the parent class using a closure as in the followi
This is a known bug in the current version of groovy and is targeted for being fixed in groovy 2.0. See GROOVY-3073.
It's happening because of a scoping bug in the metaclass where the closure in the first example can't see the private class level variable.
One potential fix that gets around the issue for this situation is to declare a local alias variable in the superclass, this gets around the scoping issue in the closure. Change the constructor to this:
ParentClass(columnCount) {
def valueAlias = values
columnCount.times { valueAlias.add('') }
}