Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.5.11
Description
Consider this Groovy class:
package test64 import groovy.transform.CompileDynamic import groovy.transform.CompileStatic @CompileStatic class Test64 { @CompileDynamic static enum ShippingAddressSynchType { ACCOUNTING { @Override void synch(Test64 customer) { truncate('foo', 2) } }; void synch(Test64 customer) { } private String truncate(String input, int maxLength) { if(!input) return input if(input.length() > maxLength) input = input[0..maxLength - 1] return input } } }
and a Java class to run it:
package test64; import test64.Test64.ShippingAddressSynchType; public class Test64Main { public static void main(String[] args) { Test64 t = new Test64(); ShippingAddressSynchType.ACCOUNTING.synch(t); } }
If you run this code, you'll get:
Exception in thread "main" groovy.lang.MissingMethodException: No signature of method: test64.Test64$ShippingAddressSynchType$1.truncate() is applicable for argument types: (String, Integer) values: [foo, 2] at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:70) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:83) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:156) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:176) at test64.Test64$ShippingAddressSynchType$1.synch(Test64.groovy:14) at test64.Test64Main.main(Test64Main.java:9)