Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.0.0-rc-2
-
None
-
None
Description
The following test failed due to accessing static field one
@groovy.transform.CompileStatic class Test1 { static sl static int one = 1 static { sl = [1, 2, 3].stream().map(e -> e + one).toList() } } assert [2, 3, 4] == Test1.sl
java.lang.ExceptionInInitializerError at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at ConsoleScript2.run(ConsoleScript2:8) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) Caused by: java.lang.ClassCastException: class Test1$__clinit__lambda1 cannot be cast to class Test1 (Test1$__clinit__lambda1 and Test1 are in unnamed module of loader groovy.lang.GroovyClassLoader$InnerLoader @f055fc9) at Test1$__clinit__lambda1.doCall(ConsoleScript2:5) at Test1.<clinit>(ConsoleScript2:5) ... 7 more
Attachments
Issue Links
- links to