Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.0-beta-5
-
None
Description
Closure tries to rsolve a method ot poperty name by first using the MetaClass, second using the owner and thirdly using the delegate. However InvokerHelper.getProperty(owner, property) always returns null if the owner is a script.
This can produce subtle bugs (e.g. when using an Expando object in a script.
exp = new Expando()
exp.a = "x"
println exp.a
exp.b =
exp.b()
exp.c = {println "a = ${this.a}"}
exp.c()
exp.c = {println "a = ${this.a}"}
exp.c.setDelegate(exp)
exp.c()
produces different output in a script and a program
Attachments
Issue Links
- is depended upon by
-
GROOVY-764 closures
- Closed