Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.1-rc-3
-
None
Description
The following code:
[code]
class DefaultNoArgCtor {
DefaultNoArgCtor(String s) {}
// DefaultNoArgCtor(int s) {} <== uncomment this line to get the BUG
}
def a = new DefaultNoArgCtor()
println a
[/code]
If you uncomment the 2nd constructor, then instead of getting an exception about not being able to find the ctor (or something similar)
what I am getting (trunk) is:
[trace]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:101)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:130)
Caused by: java.lang.ClassCastException:
org.codehaus.groovy.reflection.CachedConstructor
at org.codehaus.groovy.runtime.metaclass.MethodSelectionException.appendMethods(MethodSelectionException.java:80)
at org.codehaus.groovy.runtime.metaclass.MethodSelectionException.getMessage(MethodSelectionException.java:59)
at java.lang.Throwable.getLocalizedMessage(Throwable.java:267)
at java.lang.Throwable.toString(Throwable.java:344)
at java.lang.String.valueOf(String.java:2615)
at java.lang.StringBuffer.append(StringBuffer.java:220)
at groovy.ui.GroovyMain.run(GroovyMain.java:319)
at groovy.ui.GroovyMain.process(GroovyMain.java:294)
at groovy.ui.GroovyMain.processArgs(GroovyMain.java:111)
at groovy.ui.GroovyMain.main(GroovyMain.java:92)
... 6 more
[/trace]