From notifications-return-14518-archive-asf-public=cust-asf.ponee.io@groovy.apache.org Thu Nov 8 22:57:50 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 64E8B180671 for ; Thu, 8 Nov 2018 22:57:49 +0100 (CET) Received: (qmail 46918 invoked by uid 500); 8 Nov 2018 21:57:48 -0000 Mailing-List: contact notifications-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list notifications@groovy.apache.org Received: (qmail 46909 invoked by uid 99); 8 Nov 2018 21:57:48 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Nov 2018 21:57:48 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 1789ACE243 for ; Thu, 8 Nov 2018 21:57:48 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id BKyoUvStaOTa for ; Thu, 8 Nov 2018 21:57:45 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 74C9D6A7EA for ; Thu, 8 Nov 2018 10:14:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 051ECE25AA for ; Thu, 8 Nov 2018 10:14:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 838EF266BC for ; Thu, 8 Nov 2018 10:14:00 +0000 (UTC) Date: Thu, 8 Nov 2018 10:14:00 +0000 (UTC) From: "Paul King (JIRA)" To: notifications@groovy.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (GROOVY-8871) Long Constants Defined in Groovy 2.5.3 Under OpenJDK 11 Cause an IllegalAccessError MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/GROOVY-8871?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16679165#comment-16679165 ] Paul King edited comment on GROOVY-8871 at 11/8/18 10:13 AM: ------------------------------------------------------------- This is to do with the {{targetCompatibility}} setting you have in your build file. Can you set that version to an earlier one while still running on JDK11? Also what happens when using primitive 'long'? was (Author: paulk): I am wondering if we are seeing the right error. Compiling and using your class under JDK11 and Groovy2.5.3 works fine in the GroovyConsole. I noticed in your build file you have sourceCompatibility and targetCompatibility set to JavaVersion.VERSION_11. We don't support that in 2.5.3 even though running is fine. What happens if you set those to JavaVersion.VERSION_1_10 but still run under JDK11 obviously? Also what happens when using primitive 'long'? > 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.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: 4.10.2 > - JUnit: 4.12 > Links: > - Sample project: https://github.com/silentkevin/example-for-groovy-long-bug > - build.gradle: https://github.com/silentkevin/example-for-groovy-long-bug/blob/master/build.gradle > - Dockerfile: https://github.com/silentkevin/example-for-groovy-long-bug/blob/master/docker/Dockerfile > - Broken class: https://github.com/silentkevin/example-for-groovy-long-bug/blob/master/src/main/groovy/com/example/SomeBadClass.groovy > - Broken test 1: https://github.com/silentkevin/example-for-groovy-long-bug/blob/master/src/test/groovy/com/example/SomeClassFailsTest_1.groovy#L41 > - Broken test 2: https://github.com/silentkevin/example-for-groovy-long-bug/blob/master/src/test/groovy/com/example/SomeClassFailsTest_2.groovy#L42 > - Broken test 3: https://github.com/silentkevin/example-for-groovy-long-bug/blob/master/src/test/groovy/com/example/SomeClassFailsTest_3.groovy#L37 > - Test that works fine (just to show the whole project isn't borked): https://github.com/silentkevin/example-for-groovy-long-bug/blob/master/src/test/groovy/com/example/SomeClassSucceedsTest.groovy#L41 > Comments: > - Everything appears to work fine under OpenJDK10 with the exact same code (after changing the source and target compatibility to JDK10 in build.gradle) > - CompileStatic or not doesn't seem to matter > - To compile and run groovy under JDK11 version 2.5.3 of groovy is absolutely required so I can't really test with a different version of groovy > - If anyone has any ideas on where to look I'll be glad to look into this myself. I've been using groovy for over 5 years and might be able to make some headway with a suggestion or two. -- This message was sent by Atlassian JIRA (v7.6.3#76005)