jaypark (3) [Avatar] Offline

I think listing 7.22 is broken.

Source code
def boxer = new Expando()
assert null == boxer.takeThis
boxer.takeThis = 'ouch!'
assert 'ouch!' == boxer.takeThis
boxer.fightBack = {times -> return this.takeThis * times }
assert 'ouch!ouch!ouch!' == boxer.fightBack(3)
and output is
groovy.lang.MissingPropertyException: No such property: owner for class: Script207
at Script207$_run_closure1.doCall(Script207)
at Script207.run(Script207:6)

Is there a new keyword for this situation? or must i give a argument for boxer?

Message was edited by:
Mittie (397) [Avatar] Offline
Re: listing 7.22

yes, you are right. The erratum was added as http://groovy.canoo.com/errata/erratum/show/3 .

thanks for posting