Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 79B45200CC2 for ; Wed, 5 Jul 2017 18:29:01 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 78302163CD9; Wed, 5 Jul 2017 16:29:01 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id BFFC9163CD6 for ; Wed, 5 Jul 2017 18:29:00 +0200 (CEST) Received: (qmail 1435 invoked by uid 500); 5 Jul 2017 16:29:00 -0000 Mailing-List: contact dev-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 dev@groovy.apache.org Received: (qmail 1425 invoked by uid 99); 5 Jul 2017 16:28:59 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jul 2017 16:28:59 +0000 Received: from mail-lf0-f41.google.com (mail-lf0-f41.google.com [209.85.215.41]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 57B961A0029 for ; Wed, 5 Jul 2017 16:28:59 +0000 (UTC) Received: by mail-lf0-f41.google.com with SMTP id b207so137490024lfg.2 for ; Wed, 05 Jul 2017 09:28:59 -0700 (PDT) X-Gm-Message-State: AIVw113qAeqjRGjMeTl0TxRjz3bl/q7SkxuKTa36hfAF8x3Pbqe4AI2g TH9ucpOv7a0pP6eNG7bH+wmcIDVDwg== X-Received: by 10.25.242.11 with SMTP id q11mr6904596lfh.22.1499272137794; Wed, 05 Jul 2017 09:28:57 -0700 (PDT) MIME-Version: 1.0 Reply-To: cchampeau@apache.org Received: by 10.46.22.8 with HTTP; Wed, 5 Jul 2017 09:28:57 -0700 (PDT) From: =?UTF-8?Q?C=C3=A9dric_Champeau?= Date: Wed, 5 Jul 2017 18:28:57 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: trySetAccessible for Java 9 To: dev@groovy.apache.org Content-Type: multipart/alternative; boundary="94eb2c1cbe2c31ecaa0553947f64" archived-at: Wed, 05 Jul 2017 16:29:01 -0000 --94eb2c1cbe2c31ecaa0553947f64 Content-Type: text/plain; charset="UTF-8" Hi folks, We've made some good progress on making Gradle compatible with Java 9 as a runtime. However, since the latest release, builds easily get bloated with warnings like this: WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/home/cchampeau/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy-all/2.4.11/444a64af79c540aad257e49d95050e7c189f1309/groovy-all-2.4.11.jar) to method java.lang.Object.finalize() Which is, I think, related to calls to AccessibleObject#setAccessible in org.codehaus.groovy.reflection.CachedClass#makeAccessible. However, this class precisely _tries_ to set accessible members of a class, but doesn't necessarily _have to_. That is, precisely the semantics of the new `trySetAccessible` method in AccessibleObject on JDK 9, so I would suggest we use it. However, as you may understand, things are never so easy: for binary and runtime compatibility, we need to be able to use this method only if JDK 9 is available, so it either requires using reflection, or method handles if we are using Java 8. It would be nice to have this in the next 2.x release of Groovy, so that we can get rid of those nasty error messages, but then it also means no MethodHandle, so no fast call of that `trySetAccessible` method. We cannot use the `Java7` or `Java8` approach either, without actually _building_ on JDK 9, which would be a problem itself. Any suggestion? --94eb2c1cbe2c31ecaa0553947f64 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi folks,

We've made some good prog= ress on making Gradle compatible with Java 9 as a runtime. However, since t= he latest release, builds easily get bloated with warnings like this:
=

WARNING: An illegal reflective access operation ha= s occurred
WARNING: Illegal reflective access by org.codehaus.gro= ovy.reflection.CachedClass (file:/home/cchampeau/.gradle/caches/modules-2/f= iles-2.1/org.codehaus.groovy/groovy-all/2.4.11/444a64af79c540aad257e49d9505= 0e7c189f1309/groovy-all-2.4.11.jar) to method java.lang.Object.finalize()

Which is, I think, related to calls to Access= ibleObject#setAccessible in=C2=A0org.codehaus.groovy.reflection.CachedClass= #makeAccessible.

However, this class precisely _tr= ies_ to set accessible members of a class, but doesn't necessarily _hav= e to_. That is, precisely the semantics of the new `trySetAccessible` metho= d in AccessibleObject on JDK 9, so I would suggest we use it.
However, as you may understand, things are never so easy: for b= inary and runtime compatibility, we need to be able to use this method only= if JDK 9 is available, so it either requires using reflection, or method h= andles if we are using Java 8.

It would be nice to= have this in the next 2.x release of Groovy, so that we can get rid of tho= se nasty error messages, but then it also means no MethodHandle, so no fast= call of that `trySetAccessible` method. We cannot use the `Java7` or `Java= 8` approach either, without actually _building_ on JDK 9, which would be a = problem itself.

Any suggestion?
--94eb2c1cbe2c31ecaa0553947f64--