Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Cannot Reproduce
-
None
-
None
-
None
-
groovy eclipse 1.6.3
Description
The following code fails
//////////////////////////////////////////////////////////////////////////////
@Category(Guy) class Naming { String getTypeName() { if(this.getType() != null) this.getType().name else "" } } interface Guy { // String getName() Type getType() } class Type { String name } class MyGuyver implements Guy { Type type // String getName() {return "ver"} } def atype = new Type(name: 'String') def onetest = new MyGuyver(type:atype) //assert onetest.getName() == 'ver' use(Naming) { assert onetest.getTypeName() == onetest.getType().getName() }
//////////////////////////////////////////////////////////////////////////////
The problem is the line 'this.getType().name' in the method Naming.getTypeName()
The exception is :
Exception in thread "main" groovy.lang.MissingMethodException: No signature of method: static Naming.getType() is applicable for argument types: () values: []
at groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1364)
at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1350)
at org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.callStatic(StaticMetaClassSite.java:47)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:167)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:171)
at Naming.getTypeName(test.groovy:9)
If we use the getter method getName() instead of 'name' property accessor it works