trySetAccessible for Java 9

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
19 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

trySetAccessible for Java 9

cchampeau
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?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: trySetAccessible for Java 9

Russel Winder-3
On Wed, 2017-07-05 at 18:28 +0200, Cédric Champeau wrote:
>
[…]
> Any suggestion?

How about leave Groovy 2.x as a "can only build on JDK8", and put all effort
for a JDK9 build on Groovy 3.x which, as I understand it requires JDK8 as a
runtime. This would seem to minimise hassle and maximise forward-looking
benefit. Unless I am missing something.

--
Russel.
=============================================================================
Dr Russel Winder     t:+44 20 7585 2200   voip:sip:
[hidden email]
41 Buckmaster Road   m:+44 7770 465 077   xmpp:[hidden email]
London SW11 1EN, UK  w: www.russel.org.uk skype:russel_winder

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: trySetAccessible for Java 9

Remi Forax
In reply to this post by cchampeau
Use reflection,
have inside groovy a method needSetAccessible coded like this

private static final Method tryAccessible;
static {
  Method method;
  try {
    method = AccessibleObject.class.getMethod("tryAccessible", ...);
  } catch(NoMethodFoundException e) {
    method = null;
  }
  tryAccessible = method;
}

public static boolena needSetAccessible(...) {
  if (tryAccessible == null) {
    return true;
  }
  return tryAcessible.invoke(...);
}

with jdk <= 8 needSetAccessible() always returns true otherwise, it delegates to tryAccessible.
So in the Groovy code, instead of calling setAccessible, one just have to call needSetAccessible in a test before calling setAccessible.

cheers,
Rémi


De: "Cédric Champeau" <[hidden email]>
À: [hidden email]
Envoyé: Mercredi 5 Juillet 2017 18:28:57
Objet: trySetAccessible for Java 9
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?

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: trySetAccessible for Java 9

cchampeau
In reply to this post by Russel Winder-3
Actually I'm realizing that the `MethodHandle` API came with Java 7. So we _can_ compile against it. So I guess an option is to have the method handle redirect to `trySetAccessible` if the detected runtime is Java 9, and a backport method if < 9.



2017-07-05 18:41 GMT+02:00 Russel Winder <[hidden email]>:
On Wed, 2017-07-05 at 18:28 +0200, Cédric Champeau wrote:
>
[…]
> Any suggestion?

How about leave Groovy 2.x as a "can only build on JDK8", and put all effort
for a JDK9 build on Groovy 3.x which, as I understand it requires JDK8 as a
runtime. This would seem to minimise hassle and maximise forward-looking
benefit. Unless I am missing something.

--
Russel.
=============================================================================
Dr Russel Winder     t:<a href="tel:%2B44%2020%207585%202200" value="+442075852200">+44 20 7585 2200   voip:sip:
[hidden email]
41 Buckmaster Road   m:<a href="tel:%2B44%207770%20465%20077" value="+447770465077">+44 7770 465 077   [hidden email]
London SW11 1EN, UK  w: www.russel.org.uk skype:russel_winder

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: trySetAccessible for Java 9

Uwe Schindler

Hi,

 

I made this suggestion about a month ago! In Lucene/Elasticsearch we do everything with MethodHandles that requires new Java 9 APIs (currently Elasticsearch’s Painless Script engine is the first one that uses indy string concats!). In general I would not use an if/then/else construct at all. Just try to get a MethodHandle to trySetAccessible(), if this fails get a MethodHandle to a local/private method with same signature.

 

Finally you may need to adapt the MethodHandle to the right types and then call it _always_ with correct casting to make javac use correct types. Be sure to make the MethodHandle a static final constant somewhere! This removed the need for a if/then/else on every call.

 

I may provide a patch, if you like. I’d just need some directions where to look at. Should be a 10 liner.

 

Uwe

 

-----

Uwe Schindler

[hidden email]

ASF Member, Apache Lucene PMC / Committer

Bremen, Germany

http://lucene.apache.org/

 

From: Cédric Champeau [mailto:[hidden email]]
Sent: Wednesday, July 5, 2017 6:55 PM
To: Russel Winder <[hidden email]>
Cc: [hidden email]
Subject: Re: trySetAccessible for Java 9

 

Actually I'm realizing that the `MethodHandle` API came with Java 7. So we _can_ compile against it. So I guess an option is to have the method handle redirect to `trySetAccessible` if the detected runtime is Java 9, and a backport method if < 9.

 

 

 

2017-07-05 18:41 GMT+02:00 Russel Winder <[hidden email]>:

On Wed, 2017-07-05 at 18:28 +0200, Cédric Champeau wrote:
>
[…]
> Any suggestion?

How about leave Groovy 2.x as a "can only build on JDK8", and put all effort
for a JDK9 build on Groovy 3.x which, as I understand it requires JDK8 as a
runtime. This would seem to minimise hassle and maximise forward-looking
benefit. Unless I am missing something.

--
Russel.
=============================================================================
Dr Russel Winder     t:<a href="tel:%2B44%2020%207585%202200">+44 20 7585 2200   voip:sip:
[hidden email]
41 Buckmaster Road   m:<a href="tel:%2B44%207770%20465%20077">+44 7770 465 077   [hidden email]
London SW11 1EN, UK  w: www.russel.org.uk skype:russel_winder

 

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: trySetAccessible for Java 9

cchampeau
Thanks Uwe, patches/PRs are very welcome :) I did miss your suggestion, sorry I wasn't able to follow everything on this list lately.

The risk I saw was that the MethodHandle class wasn't always available, but for 2.4+, it's not a problem!


2017-07-05 19:07 GMT+02:00 Uwe Schindler <[hidden email]>:

Hi,

 

I made this suggestion about a month ago! In Lucene/Elasticsearch we do everything with MethodHandles that requires new Java 9 APIs (currently Elasticsearch’s Painless Script engine is the first one that uses indy string concats!). In general I would not use an if/then/else construct at all. Just try to get a MethodHandle to trySetAccessible(), if this fails get a MethodHandle to a local/private method with same signature.

 

Finally you may need to adapt the MethodHandle to the right types and then call it _always_ with correct casting to make javac use correct types. Be sure to make the MethodHandle a static final constant somewhere! This removed the need for a if/then/else on every call.

 

I may provide a patch, if you like. I’d just need some directions where to look at. Should be a 10 liner.

 

Uwe

 

-----

Uwe Schindler

[hidden email]

ASF Member, Apache Lucene PMC / Committer

Bremen, Germany

http://lucene.apache.org/

 

From: Cédric Champeau [mailto:[hidden email]]
Sent: Wednesday, July 5, 2017 6:55 PM
To: Russel Winder <[hidden email]>
Cc: [hidden email]
Subject: Re: trySetAccessible for Java 9

 

Actually I'm realizing that the `MethodHandle` API came with Java 7. So we _can_ compile against it. So I guess an option is to have the method handle redirect to `trySetAccessible` if the detected runtime is Java 9, and a backport method if < 9.

 

 

 

2017-07-05 18:41 GMT+02:00 Russel Winder <[hidden email]>:

On Wed, 2017-07-05 at 18:28 +0200, Cédric Champeau wrote:
>
[…]
> Any suggestion?

How about leave Groovy 2.x as a "can only build on JDK8", and put all effort
for a JDK9 build on Groovy 3.x which, as I understand it requires JDK8 as a
runtime. This would seem to minimise hassle and maximise forward-looking
benefit. Unless I am missing something.

--
Russel.
=============================================================================
Dr Russel Winder     t:<a href="tel:%2B44%2020%207585%202200" target="_blank">+44 20 7585 2200   voip:sip:
[hidden email]
41 Buckmaster Road   m:<a href="tel:%2B44%207770%20465%20077" target="_blank">+44 7770 465 077   [hidden email]
London SW11 1EN, UK  w: www.russel.org.uk skype:russel_winder

 


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: trySetAccessible for Java 9

Uwe Schindler

Working on it.

 

I just looked at the code and found out that it already has a „fallback“ mechanism: It first tries setAccessible(array, true) and then falls back to do it one by one. I think with Java 9, wenn cannot do this. So I’d change that to:

 

  • Get methodhandle in static initializer, if not there set to NULL
  • In the makeAccessible method check for nullness of methodhandle: if null proceed as before, if not do a for-loop and call trySetAccesible() on all, ignoring return value.

 

-----

Uwe Schindler

[hidden email]

ASF Member, Apache Lucene PMC / Committer

Bremen, Germany

http://lucene.apache.org/

 

From: Cédric Champeau [mailto:[hidden email]]
Sent: Wednesday, July 5, 2017 7:10 PM
To: [hidden email]
Cc: Russel Winder <[hidden email]>
Subject: Re: trySetAccessible for Java 9

 

Thanks Uwe, patches/PRs are very welcome :) I did miss your suggestion, sorry I wasn't able to follow everything on this list lately.

 

The risk I saw was that the MethodHandle class wasn't always available, but for 2.4+, it's not a problem!

 

 

2017-07-05 19:07 GMT+02:00 Uwe Schindler <[hidden email]>:

Hi,

 

I made this suggestion about a month ago! In Lucene/Elasticsearch we do everything with MethodHandles that requires new Java 9 APIs (currently Elasticsearch’s Painless Script engine is the first one that uses indy string concats!). In general I would not use an if/then/else construct at all. Just try to get a MethodHandle to trySetAccessible(), if this fails get a MethodHandle to a local/private method with same signature.

 

Finally you may need to adapt the MethodHandle to the right types and then call it _always_ with correct casting to make javac use correct types. Be sure to make the MethodHandle a static final constant somewhere! This removed the need for a if/then/else on every call.

 

I may provide a patch, if you like. I’d just need some directions where to look at. Should be a 10 liner.

 

Uwe

 

-----

Uwe Schindler

[hidden email]

ASF Member, Apache Lucene PMC / Committer

Bremen, Germany

http://lucene.apache.org/

 

From: Cédric Champeau [mailto:[hidden email]]
Sent: Wednesday, July 5, 2017 6:55 PM
To: Russel Winder <[hidden email]>
Cc: [hidden email]
Subject: Re: trySetAccessible for Java 9

 

Actually I'm realizing that the `MethodHandle` API came with Java 7. So we _can_ compile against it. So I guess an option is to have the method handle redirect to `trySetAccessible` if the detected runtime is Java 9, and a backport method if < 9.

 

 

 

2017-07-05 18:41 GMT+02:00 Russel Winder <[hidden email]>:

On Wed, 2017-07-05 at 18:28 +0200, Cédric Champeau wrote:
>
[…]
> Any suggestion?

How about leave Groovy 2.x as a "can only build on JDK8", and put all effort
for a JDK9 build on Groovy 3.x which, as I understand it requires JDK8 as a
runtime. This would seem to minimise hassle and maximise forward-looking
benefit. Unless I am missing something.

--
Russel.
=============================================================================
Dr Russel Winder     t:<a href="tel:%2B44%2020%207585%202200" target="_blank">+44 20 7585 2200   voip:sip:
[hidden email]
41 Buckmaster Road   m:<a href="tel:%2B44%207770%20465%20077" target="_blank">+44 7770 465 077   [hidden email]
London SW11 1EN, UK  w: www.russel.org.uk skype:russel_winder

 

 

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: trySetAccessible for Java 9

Uwe Schindler

Here is my quick patch:

https://github.com/apache/groovy/compare/master...uschindler:java9/trySetAccessible

 

Sorry for my ignorance, but how to run tests with Java 9? Gradle fails for me to launch daemon!

 

Uwe

 

-----

Uwe Schindler

[hidden email]

ASF Member, Apache Lucene PMC / Committer

Bremen, Germany

http://lucene.apache.org/

 

From: Uwe Schindler [mailto:[hidden email]]
Sent: Wednesday, July 5, 2017 7:27 PM
To: [hidden email]; [hidden email]
Subject: RE: trySetAccessible for Java 9

 

Working on it.

 

I just looked at the code and found out that it already has a „fallback“ mechanism: It first tries setAccessible(array, true) and then falls back to do it one by one. I think with Java 9, wenn cannot do this. So I’d change that to:

 

  • Get methodhandle in static initializer, if not there set to NULL
  • In the makeAccessible method check for nullness of methodhandle: if null proceed as before, if not do a for-loop and call trySetAccesible() on all, ignoring return value.

 

-----

Uwe Schindler

[hidden email]

ASF Member, Apache Lucene PMC / Committer

Bremen, Germany

http://lucene.apache.org/

 

From: Cédric Champeau [[hidden email]]
Sent: Wednesday, July 5, 2017 7:10 PM
To: [hidden email]
Cc: Russel Winder <[hidden email]>
Subject: Re: trySetAccessible for Java 9

 

Thanks Uwe, patches/PRs are very welcome :) I did miss your suggestion, sorry I wasn't able to follow everything on this list lately.

 

The risk I saw was that the MethodHandle class wasn't always available, but for 2.4+, it's not a problem!

 

 

2017-07-05 19:07 GMT+02:00 Uwe Schindler <[hidden email]>:

Hi,

 

I made this suggestion about a month ago! In Lucene/Elasticsearch we do everything with MethodHandles that requires new Java 9 APIs (currently Elasticsearch’s Painless Script engine is the first one that uses indy string concats!). In general I would not use an if/then/else construct at all. Just try to get a MethodHandle to trySetAccessible(), if this fails get a MethodHandle to a local/private method with same signature.

 

Finally you may need to adapt the MethodHandle to the right types and then call it _always_ with correct casting to make javac use correct types. Be sure to make the MethodHandle a static final constant somewhere! This removed the need for a if/then/else on every call.

 

I may provide a patch, if you like. I’d just need some directions where to look at. Should be a 10 liner.

 

Uwe

 

-----

Uwe Schindler

[hidden email]

ASF Member, Apache Lucene PMC / Committer

Bremen, Germany

http://lucene.apache.org/

 

From: Cédric Champeau [mailto:[hidden email]]
Sent: Wednesday, July 5, 2017 6:55 PM
To: Russel Winder <[hidden email]>
Cc: [hidden email]
Subject: Re: trySetAccessible for Java 9

 

Actually I'm realizing that the `MethodHandle` API came with Java 7. So we _can_ compile against it. So I guess an option is to have the method handle redirect to `trySetAccessible` if the detected runtime is Java 9, and a backport method if < 9.

 

 

 

2017-07-05 18:41 GMT+02:00 Russel Winder <[hidden email]>:

On Wed, 2017-07-05 at 18:28 +0200, Cédric Champeau wrote:
>
[…]
> Any suggestion?

How about leave Groovy 2.x as a "can only build on JDK8", and put all effort
for a JDK9 build on Groovy 3.x which, as I understand it requires JDK8 as a
runtime. This would seem to minimise hassle and maximise forward-looking
benefit. Unless I am missing something.

--
Russel.
=============================================================================
Dr Russel Winder     t:<a href="tel:%2B44%2020%207585%202200" target="_blank">+44 20 7585 2200   voip:sip:
[hidden email]
41 Buckmaster Road   m:<a href="tel:%2B44%207770%20465%20077" target="_blank">+44 7770 465 077   [hidden email]
London SW11 1EN, UK  w: www.russel.org.uk skype:russel_winder

 

 

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: trySetAccessible for Java 9

cchampeau
Thanks Uwe! To test with JDK 9 you'll need Gradle 4.1-milestone-1. I know Jochen has some special setup to make it work on previous releases of Gradle but I didn't try that.

2017-07-05 20:09 GMT+02:00 Uwe Schindler <[hidden email]>:

Here is my quick patch:

https://github.com/apache/groovy/compare/master...uschindler:java9/trySetAccessible

 

Sorry for my ignorance, but how to run tests with Java 9? Gradle fails for me to launch daemon!

 

Uwe

 

-----

Uwe Schindler

[hidden email]

ASF Member, Apache Lucene PMC / Committer

Bremen, Germany

http://lucene.apache.org/

 

From: Uwe Schindler [mailto:[hidden email]]
Sent: Wednesday, July 5, 2017 7:27 PM
To: [hidden email]; [hidden email]
Subject: RE: trySetAccessible for Java 9

 

Working on it.

 

I just looked at the code and found out that it already has a „fallback“ mechanism: It first tries setAccessible(array, true) and then falls back to do it one by one. I think with Java 9, wenn cannot do this. So I’d change that to:

 

  • Get methodhandle in static initializer, if not there set to NULL
  • In the makeAccessible method check for nullness of methodhandle: if null proceed as before, if not do a for-loop and call trySetAccesible() on all, ignoring return value.

 

-----

Uwe Schindler

[hidden email]

ASF Member, Apache Lucene PMC / Committer

Bremen, Germany

http://lucene.apache.org/

 

From: Cédric Champeau [[hidden email]]
Sent: Wednesday, July 5, 2017 7:10 PM
To: [hidden email]
Cc: Russel Winder <[hidden email]>
Subject: Re: trySetAccessible for Java 9

 

Thanks Uwe, patches/PRs are very welcome :) I did miss your suggestion, sorry I wasn't able to follow everything on this list lately.

 

The risk I saw was that the MethodHandle class wasn't always available, but for 2.4+, it's not a problem!

 

 

2017-07-05 19:07 GMT+02:00 Uwe Schindler <[hidden email]>:

Hi,

 

I made this suggestion about a month ago! In Lucene/Elasticsearch we do everything with MethodHandles that requires new Java 9 APIs (currently Elasticsearch’s Painless Script engine is the first one that uses indy string concats!). In general I would not use an if/then/else construct at all. Just try to get a MethodHandle to trySetAccessible(), if this fails get a MethodHandle to a local/private method with same signature.

 

Finally you may need to adapt the MethodHandle to the right types and then call it _always_ with correct casting to make javac use correct types. Be sure to make the MethodHandle a static final constant somewhere! This removed the need for a if/then/else on every call.

 

I may provide a patch, if you like. I’d just need some directions where to look at. Should be a 10 liner.

 

Uwe

 

-----

Uwe Schindler

[hidden email]

ASF Member, Apache Lucene PMC / Committer

Bremen, Germany

http://lucene.apache.org/

 

From: Cédric Champeau [mailto:[hidden email]]
Sent: Wednesday, July 5, 2017 6:55 PM
To: Russel Winder <[hidden email]>
Cc: [hidden email]
Subject: Re: trySetAccessible for Java 9

 

Actually I'm realizing that the `MethodHandle` API came with Java 7. So we _can_ compile against it. So I guess an option is to have the method handle redirect to `trySetAccessible` if the detected runtime is Java 9, and a backport method if < 9.

 

 

 

2017-07-05 18:41 GMT+02:00 Russel Winder <[hidden email]>:

On Wed, 2017-07-05 at 18:28 +0200, Cédric Champeau wrote:
>
[…]
> Any suggestion?

How about leave Groovy 2.x as a "can only build on JDK8", and put all effort
for a JDK9 build on Groovy 3.x which, as I understand it requires JDK8 as a
runtime. This would seem to minimise hassle and maximise forward-looking
benefit. Unless I am missing something.

--
Russel.
=============================================================================
Dr Russel Winder     t:<a href="tel:%2B44%2020%207585%202200" target="_blank">+44 20 7585 2200   voip:sip:
[hidden email]
41 Buckmaster Road   m:<a href="tel:%2B44%207770%20465%20077" target="_blank">+44 7770 465 077   [hidden email]
London SW11 1EN, UK  w: www.russel.org.uk skype:russel_winder

 

 


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: trySetAccessible for Java 9

jwagenleitner
In reply to this post by cchampeau
The 2.4 branch still supports Java 6+ and believe that 2.5+ is where Java 7 starts as a baseline.  The VMPlugin mechanism may be one approach to consider, having it provide a setAccessible(AccessibleObject) method where the Java7 or higher plugins can invoke the MethodHandle if available or fall back to the regular setAccessible call.

On Wed, Jul 5, 2017 at 10:10 AM, Cédric Champeau <[hidden email]> wrote:
Thanks Uwe, patches/PRs are very welcome :) I did miss your suggestion, sorry I wasn't able to follow everything on this list lately.

The risk I saw was that the MethodHandle class wasn't always available, but for 2.4+, it's not a problem!


2017-07-05 19:07 GMT+02:00 Uwe Schindler <[hidden email]>:

Hi,

 

I made this suggestion about a month ago! In Lucene/Elasticsearch we do everything with MethodHandles that requires new Java 9 APIs (currently Elasticsearch’s Painless Script engine is the first one that uses indy string concats!). In general I would not use an if/then/else construct at all. Just try to get a MethodHandle to trySetAccessible(), if this fails get a MethodHandle to a local/private method with same signature.

 

Finally you may need to adapt the MethodHandle to the right types and then call it _always_ with correct casting to make javac use correct types. Be sure to make the MethodHandle a static final constant somewhere! This removed the need for a if/then/else on every call.

 

I may provide a patch, if you like. I’d just need some directions where to look at. Should be a 10 liner.

 

Uwe

 

-----

Uwe Schindler

[hidden email]

ASF Member, Apache Lucene PMC / Committer

Bremen, Germany

http://lucene.apache.org/

 

From: Cédric Champeau [mailto:[hidden email]]
Sent: Wednesday, July 5, 2017 6:55 PM
To: Russel Winder <[hidden email]>
Cc: [hidden email]
Subject: Re: trySetAccessible for Java 9

 

Actually I'm realizing that the `MethodHandle` API came with Java 7. So we _can_ compile against it. So I guess an option is to have the method handle redirect to `trySetAccessible` if the detected runtime is Java 9, and a backport method if < 9.

 

 

 

2017-07-05 18:41 GMT+02:00 Russel Winder <[hidden email]>:

On Wed, 2017-07-05 at 18:28 +0200, Cédric Champeau wrote:
>
[…]
> Any suggestion?

How about leave Groovy 2.x as a "can only build on JDK8", and put all effort
for a JDK9 build on Groovy 3.x which, as I understand it requires JDK8 as a
runtime. This would seem to minimise hassle and maximise forward-looking
benefit. Unless I am missing something.

--
Russel.
=============================================================================
Dr Russel Winder     t:<a href="tel:%2B44%2020%207585%202200" target="_blank">+44 20 7585 2200   voip:sip:
[hidden email]
41 Buckmaster Road   m:<a href="tel:%2B44%207770%20465%20077" target="_blank">+44 7770 465 077   [hidden email]
London SW11 1EN, UK  w: www.russel.org.uk skype:russel_winder

 



12
Loading...