[jira] [Created] (GROOVY-8871) Long Constants Defined in Groovy 2.5.3 Under OpenJDK 11 Cause an IllegalAccessError
Kevin Brown created GROOVY-8871: --- Summary: Long Constants Defined in Groovy 2.5.3 Under OpenJDK 11 Cause an IllegalAccessError Key: GROOVY-8871 URL: https://issues.apache.org/jira/browse/GROOVY-8871 Project: Groovy Issue Type: Bug Affects Versions: 2.5.3 Environment: OpenJDK11 on MacOSX 10.14 and Debian Linux (through docker) Reporter: Kevin Brown The following groovy code: {code:java} class SomeBadClass { SomeBadClass() { Long a = 1_457_366_400_000L } } new SomeBadClass(){code} causes the following exception to be thrown: {code:java} java.lang.IllegalAccessError: Update to static final field com.example.SomeBadClass.$const$0 attempted from a different method (__$swapInit) than the initializer method at com.example.SomeBadClass.__$swapInit(SomeBadClass.groovy) at com.example.SomeBadClass.(SomeBadClass.groovy) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83) at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:59) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:237) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:241) at com.example.SomeClassFailsTest_3.testSomething(SomeClassFailsTest_3.groovy:37) 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 java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:27) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70){code} I created a small sample project to show this happening (using gradle 4.10.2): https://github.com/silentkevin/example-for-groovy-long-bug The example project builds a docker image that can be run to easily show the issue: {code} docker run silentkevin/example-for-groovy-long-bug {code} Versions: - Runtime: Oracle OpenJDK 11.0.1 (tried on MacOSX 10.14 and on Debian Linux using official openjdk docker image 11.0.1-jdk) - Groovy: 2.5.3 - Gradle:
[jira] [Commented] (GROOVY-8871) Long Constants Defined in Groovy 2.5.3 Under OpenJDK 11 Cause an IllegalAccessError
[ https://issues.apache.org/jira/browse/GROOVY-8871?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16678749#comment-16678749 ] Kevin Brown commented on GROOVY-8871: - Attached the example project as a zip just in case github links aren't working for some. > Long Constants Defined in Groovy 2.5.3 Under OpenJDK 11 Cause an > IllegalAccessError > --- > > Key: GROOVY-8871 > URL: https://issues.apache.org/jira/browse/GROOVY-8871 > Project: Groovy > Issue Type: Bug >Affects Versions: 2.5.3 > Environment: OpenJDK11 on MacOSX 10.14 and Debian Linux (through > docker) >Reporter: Kevin Brown >Priority: Blocker > Attachments: example-for-groovy-long-bug.zip > > > The following groovy code: > {code:java} > class SomeBadClass { > SomeBadClass() { > Long a = 1_457_366_400_000L > } > } > new SomeBadClass(){code} > causes the following exception to be thrown: > {code:java} > java.lang.IllegalAccessError: Update to static final field > com.example.SomeBadClass.$const$0 attempted from a different method > (__$swapInit) than the initializer method >at com.example.SomeBadClass.__$swapInit(SomeBadClass.groovy) >at com.example.SomeBadClass.(SomeBadClass.groovy) >at > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native > Method) >at > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) >at > java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) >at > java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) >at > org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83) >at > org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105) >at > org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:59) >at > org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:237) >at > org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:241) >at > com.example.SomeClassFailsTest_3.testSomething(SomeClassFailsTest_3.groovy:37) >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 java.base/java.lang.reflect.Method.invoke(Method.java:566) >at > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) >at > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) >at > org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) >at > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) >at > org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) >at > org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) >at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) >at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) >at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) >at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) >at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) >at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) >at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) >at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) >at org.junit.runners.ParentRunner.run(ParentRunner.java:363) >at org.junit.runners.Suite.runChild(Suite.java:128) >at org.junit.runners.Suite.runChild(Suite.java:27) >at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) >at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) >at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) >at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) >at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) >at org.junit.runners.ParentRunner.run(ParentRunner.java:363) >at org.junit.runner.JUnitCore.run(JUnitCore.java:137) >at > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) >at > com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) >at > com.intellij.rt.execution.junit.J
[jira] [Updated] (GROOVY-8871) Long Constants Defined in Groovy 2.5.3 Under OpenJDK 11 Cause an IllegalAccessError
[ https://issues.apache.org/jira/browse/GROOVY-8871?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Kevin Brown updated GROOVY-8871: Attachment: example-for-groovy-long-bug.zip > Long Constants Defined in Groovy 2.5.3 Under OpenJDK 11 Cause an > IllegalAccessError > --- > > Key: GROOVY-8871 > URL: https://issues.apache.org/jira/browse/GROOVY-8871 > Project: Groovy > Issue Type: Bug >Affects Versions: 2.5.3 > Environment: OpenJDK11 on MacOSX 10.14 and Debian Linux (through > docker) >Reporter: Kevin Brown >Priority: Blocker > Attachments: example-for-groovy-long-bug.zip > > > The following groovy code: > {code:java} > class SomeBadClass { > SomeBadClass() { > Long a = 1_457_366_400_000L > } > } > new SomeBadClass(){code} > causes the following exception to be thrown: > {code:java} > java.lang.IllegalAccessError: Update to static final field > com.example.SomeBadClass.$const$0 attempted from a different method > (__$swapInit) than the initializer method >at com.example.SomeBadClass.__$swapInit(SomeBadClass.groovy) >at com.example.SomeBadClass.(SomeBadClass.groovy) >at > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native > Method) >at > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) >at > java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) >at > java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) >at > org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83) >at > org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105) >at > org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:59) >at > org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:237) >at > org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:241) >at > com.example.SomeClassFailsTest_3.testSomething(SomeClassFailsTest_3.groovy:37) >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 java.base/java.lang.reflect.Method.invoke(Method.java:566) >at > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) >at > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) >at > org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) >at > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) >at > org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) >at > org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) >at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) >at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) >at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) >at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) >at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) >at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) >at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) >at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) >at org.junit.runners.ParentRunner.run(ParentRunner.java:363) >at org.junit.runners.Suite.runChild(Suite.java:128) >at org.junit.runners.Suite.runChild(Suite.java:27) >at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) >at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) >at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) >at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) >at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) >at org.junit.runners.ParentRunner.run(ParentRunner.java:363) >at org.junit.runner.JUnitCore.run(JUnitCore.java:137) >at > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) >at > com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) >at > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) >at > com.intellij.rt.execution.junit
[jira] [Commented] (GROOVY-8871) Long Constants Defined in Groovy 2.5.3 Under OpenJDK 11 Cause an IllegalAccessError
[ https://issues.apache.org/jira/browse/GROOVY-8871?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16678814#comment-16678814 ] Kevin Brown commented on GROOVY-8871: - Output from docker run showing 3 failing tests (and one succeeding): {code} + docker run --name example-for-groovy-long-bug example-for-groovy-long-bug:latest + ls -lah total 40K drwxr-xr-x 1 root root 4.0K Nov 7 21:38 . drwxr-xr-x 1 root root 4.0K Nov 7 19:56 .. drwxr-xr-x 5 root root 4.0K Nov 7 21:37 .gradle -rw-r--r-- 1 root root 362 Nov 7 20:08 build.gradle drwxr-xr-x 1 root root 4.0K Nov 7 21:37 gradle -rwxr-xr-x 1 root root 5.2K Nov 7 21:37 gradlew -rw-r--r-- 1 root root 2.3K Nov 7 21:38 gradlew.bat -rw-r--r-- 1 root root 45 Nov 7 18:17 settings.gradle drwxr-xr-x 4 root root 4.0K Nov 7 21:38 src /opt/example + pwd + export + sort declare -x HOME="/root" declare -x HOSTNAME="d9586374f19d" declare -x JAVA_DEBIAN_VERSION="11.0.1+13-2" declare -x JAVA_HOME="/docker-java-home" declare -x JAVA_VERSION="11.0.1" declare -x LANG="C.UTF-8" declare -x OLDPWD declare -x PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" declare -x PWD="/opt/example" declare -x SHLVL="1" + ./gradlew --no-daemon --info build test check Initialized native services in: /root/.gradle/native Using 4 worker leases. A locale sensitive service provider returned null for a localized objects, which should not happen. provider: sun.util.cldr.CLDRCalendarDataProviderImpl@702ed190 locale: en A locale sensitive service provider returned null for a localized objects, which should not happen. provider: sun.util.cldr.CLDRCalendarDataProviderImpl@702ed190 locale: en A locale sensitive service provider returned null for a localized objects, which should not happen. provider: sun.util.cldr.CLDRCalendarDataProviderImpl@702ed190 locale: en A locale sensitive service provider returned null for a localized objects, which should not happen. provider: sun.util.cldr.CLDRCalendarDataProviderImpl@702ed190 locale: en Starting Build WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/root/.gradle/wrapper/dists/gradle-4.10.2-all/9fahxiiecdb76a5g3aw9oi8rv/gradle-4.10.2/lib/groovy-all-2.4.15.jar) to method java.lang.Object.finalize() WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release Settings evaluated using settings file '/opt/example/settings.gradle'. Projects loaded. Root project using build file '/opt/example/build.gradle'. Included projects: [root project 'example-for-groovy-bug'] > Configure project : Evaluating root project 'example-for-groovy-bug' using build file '/opt/example/build.gradle'. All projects evaluated. Selected primary task 'build' from project : Selected primary task 'test' from project : Selected primary task 'check' from project : Tasks to be executed: [task ':compileJava', task ':compileGroovy', task ':processResources', task ':classes', task ':jar', task ':assemble', task ':compileTestJava', task ':compileTestGroovy', task ':processTestResources', task ':testClasses', task ':test', task ':check', task ':build'] :compileJava (Thread[main,5,main]) started. > Task :compileJava NO-SOURCE file or directory '/opt/example/src/main/java', not found Skipping task ':compileJava' as it has no source files and no previous output files. :compileJava (Thread[main,5,main]) completed. Took 0.124 secs. :compileGroovy (Thread[main,5,main]) started. > Task :compileGroovy Task ':compileGroovy' is not up-to-date because: No history is available. Starting process 'Gradle Worker Daemon 1'. Working directory: /root/.gradle/workers Command: /usr/lib/jvm/java-11-openjdk-amd64/bin/java @/tmp/gradle-worker-classpath1607158660065208txt -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant worker.org.gradle.process.internal.worker.GradleWorkerMain 'Gradle Worker Daemon 1' Successfully started process 'Gradle Worker Daemon 1' Started Gradle worker daemon (0.738 secs) with fork options DaemonForkOptions{executable=/usr/lib/jvm/java-11-openjdk-amd64/bin/java, minHeapSize=null, maxHeapSize=null, jvmArgs=[], classpath=[/root/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy-ant/2.5.3/e32a424938134cf9d022cbc53fca44abe14d1623/groovy-ant-2.5.3.jar, /root/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy/2.5.3/b69558cc55b4679f6c401dfd1b54a8a5ffbd06b1/groovy-2.5.3.jar, /root/.gradle/caches/modules-2/files-2.1/org.apache.ant/ant-junit/1.9.13/618f3aac074fabfea4712db2635409a592da9ecd/ant-junit-1.9.13.jar, /root/.gradle/caches/modules-2/files-2.1/org.apache.ant/ant/1.9.13/7aff87f91ffda691675
[jira] [Commented] (GROOVY-8871) Long Constants Defined in Groovy 2.5.3 Under OpenJDK 11 Cause an IllegalAccessError
[ https://issues.apache.org/jira/browse/GROOVY-8871?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16680049#comment-16680049 ] Kevin Brown commented on GROOVY-8871: - [~paulk] When I set targetCompatibility to JavaVersion.VERSION_1_10 everything works fine while still running under JDK11 (both osx and linux/docker). Using the primitive long seems to have the same behavior: Doesn't work: {code} long doesntWork1 = 1_000L long doesntWork2 = 1_457_366_400_000L long doesntWork3 = 1_457_366_400_000 {code} Does work: {code} long doesWork1 = 1_000 long doesWork2 = new Long("145736640") {code} > Long Constants Defined in Groovy 2.5.3 Under OpenJDK 11 Cause an > IllegalAccessError > --- > > Key: GROOVY-8871 > URL: https://issues.apache.org/jira/browse/GROOVY-8871 > Project: Groovy > Issue Type: Bug >Affects Versions: 2.5.3 > Environment: OpenJDK11 on MacOSX 10.14 and Debian Linux (through > docker) >Reporter: Kevin Brown >Priority: Critical > Attachments: example-for-groovy-long-bug.zip > > > The following groovy code: > {code:java} > class SomeBadClass { > SomeBadClass() { > Long a = 1_457_366_400_000L > } > } > new SomeBadClass(){code} > causes the following exception to be thrown: > {code:java} > java.lang.IllegalAccessError: Update to static final field > com.example.SomeBadClass.$const$0 attempted from a different method > (__$swapInit) than the initializer method >at com.example.SomeBadClass.__$swapInit(SomeBadClass.groovy) >at com.example.SomeBadClass.(SomeBadClass.groovy) >at > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native > Method) >at > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) >at > java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) >at > java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) >at > org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83) >at > org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105) >at > org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:59) >at > org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:237) >at > org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:241) >at > com.example.SomeClassFailsTest_3.testSomething(SomeClassFailsTest_3.groovy:37) >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 java.base/java.lang.reflect.Method.invoke(Method.java:566) >at > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) >at > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) >at > org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) >at > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) >at > org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) >at > org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) >at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) >at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) >at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) >at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) >at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) >at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) >at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) >at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) >at org.junit.runners.ParentRunner.run(ParentRunner.java:363) >at org.junit.runners.Suite.runChild(Suite.java:128) >at org.junit.runners.Suite.runChild(Suite.java:27) >at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) >at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) >at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) >at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) >at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:26
[jira] [Comment Edited] (GROOVY-8871) Long Constants Defined in Groovy 2.5.3 Under OpenJDK 11 Cause an IllegalAccessError
[ https://issues.apache.org/jira/browse/GROOVY-8871?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16680049#comment-16680049 ] Kevin Brown edited comment on GROOVY-8871 at 11/8/18 5:27 PM: -- [~paulk] When I set targetCompatibility to JavaVersion.VERSION_1_10 everything works fine while still running under JDK11 (both osx and linux/docker). Using the primitive long seems to have the same behavior: Doesn't work: {code} long doesntWork1 = 1_000L long doesntWork2 = 1_457_366_400_000L long doesntWork3 = 1_457_366_400_000 {code} Does work: {code} long doesWork1 = 1_000 long doesWork2 = new Long("145736640") {code} Another note: if you notice creating the long from the string seems to work and could be a viable workaround for now (it worked in my actual code). was (Author: silentkevin): [~paulk] When I set targetCompatibility to JavaVersion.VERSION_1_10 everything works fine while still running under JDK11 (both osx and linux/docker). Using the primitive long seems to have the same behavior: Doesn't work: {code} long doesntWork1 = 1_000L long doesntWork2 = 1_457_366_400_000L long doesntWork3 = 1_457_366_400_000 {code} Does work: {code} long doesWork1 = 1_000 long doesWork2 = new Long("145736640") {code} > Long Constants Defined in Groovy 2.5.3 Under OpenJDK 11 Cause an > IllegalAccessError > --- > > Key: GROOVY-8871 > URL: https://issues.apache.org/jira/browse/GROOVY-8871 > Project: Groovy > Issue Type: Bug >Affects Versions: 2.5.3 > Environment: OpenJDK11 on MacOSX 10.14 and Debian Linux (through > docker) >Reporter: Kevin Brown >Priority: Critical > Attachments: example-for-groovy-long-bug.zip > > > The following groovy code: > {code:java} > class SomeBadClass { > SomeBadClass() { > Long a = 1_457_366_400_000L > } > } > new SomeBadClass(){code} > causes the following exception to be thrown: > {code:java} > java.lang.IllegalAccessError: Update to static final field > com.example.SomeBadClass.$const$0 attempted from a different method > (__$swapInit) than the initializer method >at com.example.SomeBadClass.__$swapInit(SomeBadClass.groovy) >at com.example.SomeBadClass.(SomeBadClass.groovy) >at > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native > Method) >at > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) >at > java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) >at > java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) >at > org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83) >at > org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105) >at > org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:59) >at > org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:237) >at > org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:241) >at > com.example.SomeClassFailsTest_3.testSomething(SomeClassFailsTest_3.groovy:37) >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 java.base/java.lang.reflect.Method.invoke(Method.java:566) >at > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) >at > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) >at > org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) >at > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) >at > org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) >at > org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) >at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) >at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) >at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) >at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) >at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) >at org.junit.runners.ParentRunner.runChildren(P
[jira] [Commented] (GROOVY-8871) Long Constants Defined in Groovy 2.5.3 Under OpenJDK 11 Cause an IllegalAccessError
[ https://issues.apache.org/jira/browse/GROOVY-8871?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16680423#comment-16680423 ] Kevin Brown commented on GROOVY-8871: - Thanks [~paulk]. For reference can you point me to the commit that fixed this so I can learn what is going on here? > Long Constants Defined in Groovy 2.5.3 Under OpenJDK 11 Cause an > IllegalAccessError > --- > > Key: GROOVY-8871 > URL: https://issues.apache.org/jira/browse/GROOVY-8871 > Project: Groovy > Issue Type: Bug >Affects Versions: 2.5.3 > Environment: OpenJDK11 on MacOSX 10.14 and Debian Linux (through > docker) >Reporter: Kevin Brown >Assignee: Paul King >Priority: Critical > Fix For: 3.0.0-alpha-4, 2.5.4 > > Attachments: example-for-groovy-long-bug.zip > > > The following groovy code: > {code:java} > class SomeBadClass { > SomeBadClass() { > Long a = 1_457_366_400_000L > } > } > new SomeBadClass(){code} > causes the following exception to be thrown: > {code:java} > java.lang.IllegalAccessError: Update to static final field > com.example.SomeBadClass.$const$0 attempted from a different method > (__$swapInit) than the initializer method >at com.example.SomeBadClass.__$swapInit(SomeBadClass.groovy) >at com.example.SomeBadClass.(SomeBadClass.groovy) >at > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native > Method) >at > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) >at > java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) >at > java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) >at > org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83) >at > org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105) >at > org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:59) >at > org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:237) >at > org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:241) >at > com.example.SomeClassFailsTest_3.testSomething(SomeClassFailsTest_3.groovy:37) >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 java.base/java.lang.reflect.Method.invoke(Method.java:566) >at > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) >at > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) >at > org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) >at > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) >at > org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) >at > org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) >at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) >at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) >at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) >at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) >at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) >at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) >at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) >at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) >at org.junit.runners.ParentRunner.run(ParentRunner.java:363) >at org.junit.runners.Suite.runChild(Suite.java:128) >at org.junit.runners.Suite.runChild(Suite.java:27) >at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) >at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) >at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) >at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) >at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) >at org.junit.runners.ParentRunner.run(ParentRunner.java:363) >at org.junit.runner.JUnitCore.run(JUnitCore.java:137) >at > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) >at > com.intellij.rt.execution.junit.Idea