Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.6-beta-2, 1.6-rc-1, 1.6-rc-2, 1.6-rc-3, 1.6
-
None
-
None
Description
Looks like there is a problem using <CLASSNAME>.class to reference a class instance for CLASSNAME in an interface definition.
class A { static Class type = A.class } println A.type interface B { Class type = B.class } println B.type
This prints out:
class A
And then pukes up:
java.lang.NoSuchMethodError: B$1.$get$$class$B()Ljava/lang/Class; at B.<clinit>(ConsoleScript13) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:164) at ConsoleScript13.class$(ConsoleScript13) at ConsoleScript13.$get$$class$B(ConsoleScript13) at ConsoleScript13.run(ConsoleScript13:11) at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:256) at groovy.lang.GroovyShell.run(GroovyShell.java:471) at groovy.lang.GroovyShell.run(GroovyShell.java:451) at groovy.lang.GroovyShell.run(GroovyShell.java:160) at groovy.lang.GroovyShell$run$0.call(Unknown Source) at groovy.ui.Console$_runScriptImpl_closure13.doCall(Console.groovy:732) 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.reflection.CachedMethod.invoke(CachedMethod.java:86) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:892) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:150) at groovy.ui.Console$_runScriptImpl_closure13.doCall(Console.groovy) 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.reflection.CachedMethod.invoke(CachedMethod.java:86) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:892) at groovy.lang.Closure.call(Closure.java:279) at groovy.lang.Closure.call(Closure.java:274) at groovy.lang.Closure.run(Closure.java:355) at java.lang.Thread.run(Thread.java:613)
I ran the same code in Groovy 1.5.7, and it prints:
class A interface B
I've tried 1.6.0, 1.6-RC-2 and 1.6-beta-2, all behave the same as 1.6.0. Anyone know what broke and why?