Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Testcase included:yes
-
Number of attachments :
Description
When getProperty is used e.g., to mimic a Map behaviour, the result differs depending on whether getProperty was defined directly in the class, added through a mixin, or through a metaclass.
===
class FooWorksAsMap { // class names the same length as LinkedHashMap to make output pretty
def getProperty(String foo)
}
class BarWorksAsMap {}
class BaxWorksAsMap {}
@Category(BarWorksAsMap) class C {
def getProperty(String foo)
}
BarWorksAsMap.mixin C
BaxWorksAsMap.metaClass.getProperty =
def maps = [new FooWorksAsMap(), new BarWorksAsMap(), new BaxWorksAsMap(),
[foo:'OK:LinkedHashMap.foo', class:'OK:LinkedHashMap.class']]
for (def prop in ['foo','class']) {
for (def m in maps) {
def op = "$
.$prop"
try
catch (t)
{ println "$op -> FAIL:$t" } }
}
===