While experimenting with ExpandMetaClass I ran into this behaviour:
class A {}
A.metaClass.foo = { 0 }
A.metaClass.foo = { 1 }
println (new A().foo())
A.metaClass.foo = { 2 }
println (new A().foo())
Collection.metaClass.foo = { 0 }
Collection.metaClass.foo = { 1 }
println ([].foo())
Collection.metaClass.foo = { 2 }
println ([].foo())
Which prints
1
2
1
1
Which doesn't seem to be consistent. What's the rationale behind this behavior?
Sounds like a bug. You should fill a JIRA.
It works per instance: