Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.1-rc-2
-
None
-
Mac OS X 10.4; JDK 1.5; Groovy 1.1-RC-2
Description
See http://www.nabble.com/EMC-and-a-property-tf4956215.html
I have two classes A and B. A is enhanced with meta magic (EMC): a property and a method which should work on this property. B calls the meta method from A, though the property will not change whatever I try. Here's the code:
ExpandoMetaClass.enableGlobally()
class A {}
A.metaClass.status = 'empty'
A.metaClass.change =
class B {
def getStatus() {
def a = new A();
a.change('filled')
println "status from A through B is: ${a.status}"
}
}
new B().status
The output is:
status from A changed to: filled
status from A through B is: empty
What I expect in the last line is a 'filled' instead of an 'empty'.