Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.3.3, 2.4.0-beta-1
-
None
-
None
Description
This script:
import groovy.transform.AutoClone import groovy.transform.CompileStatic @CompileStatic @AutoClone class Event { Long timeStamp = -1 } println Event // OK println new Event() // VerifyError
compiles OK but fails with a VerifyError when run:
java.lang.VerifyError: (class: Event, method: clone signature: ()Ljava/lang/Object;) Bad access to protected data at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493) at java.lang.Class.getDeclaredConstructors(Class.java:1901) at org.codehaus.groovy.reflection.CachedClass$2$1.run(CachedClass.java:69) at java.security.AccessController.doPrivileged(Native Method) at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:66) at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:64) at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) at org.codehaus.groovy.reflection.CachedClass.getConstructors(CachedClass.java:263) at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:190) at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:194) at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createNormalMetaClass(MetaClassRegistry.java:158) at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createWithCustomLookup(MetaClassRegistry.java:148) at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.create(MetaClassRegistry.java:131) at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:209) at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:241) at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:255) at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:859) at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallConstructorSite(CallSiteArray.java:84) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186) at ConsoleScript0.run(ConsoleScript0:13) at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:258) at groovy.lang.GroovyShell.run(GroovyShell.java:502) at groovy.lang.GroovyShell.run(GroovyShell.java:481) at groovy.lang.GroovyShell.run(GroovyShell.java:164) at groovy.lang.GroovyShell$run$0.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124) at groovy.ui.Console$_runScriptImpl_closure17.doCall(Console.groovy:977) at groovy.ui.Console$_runScriptImpl_closure17.doCall(Console.groovy) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:910) at groovy.lang.Closure.call(Closure.java:423) at groovy.lang.Closure.call(Closure.java:417) at groovy.lang.Closure.run(Closure.java:504) at java.lang.Thread.run(Thread.java:745)
Without CompileStatic it runs fine.