The "illegal reflective access" warnings on Java 9+ and Griffon

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

The "illegal reflective access" warnings on Java 9+ and Griffon

zlatinb
Hi,

I'm developing a Groovy+Swing application with Griffon and am concerned about these "illegal reflective access" warnings on Java 9 and newer.  I know they are only warnings (so far!) but who knows what's going to happen with Java 15.  I am packaging my application with the JPackage tool introduced with Java 14 so I have to keep up with the latest Java releases.

With the default Groovy version that the lazybones template pulled for me the warning was somewhere in the Groovy libraries.  So I changed Groovy to version 3.0.4 and the warning moved to

com.google.inject.internal.cglib.core.$ReflectUtils$1

So I'm wondering whether it's worth the effort to try and upgrade just the "cglib" dependency, or whether I should just wait for Griffon 3.

Note that if Java 15 does indeed prohibit that type of reflective access I will be in a pretty bad position as Java 14 is not LTS.  So I'm willing to try pre-release builds of Griffon 3 if such are available anywhere.

Thank you for your time,
Zlatin Balevsky
Reply | Threaded
Open this post in threaded view
|

Re: The "illegal reflective access" warnings on Java 9+ and Griffon

aalmiray
Administrator
Hi Zlatin,

The warning you see after upgrading Groovy to 3.0.4 is more likely related to Google Guice. I have not checked yet but probably the latest version (4.2.3) has solved the issue. Griffon 2.x should be compatible with Guice 4.2.3.

Now regarding Griffon 3.x, works is still ongoing to make it final. There are 2 blockers at the time:
- releasing a final version of JSR-377.
- porting all Griffon plugins to 3.x.

The first requires the finalization of the spec document. Still in progress.
The second requires some code changes. A few plugins have been ported already but nothing is yet published.

If you'd like to take it Griffon 3.x for a spin you would have to build your won snapshots of the following dependencies first:

https://github.com/jsr377/jsr377-api
https://github.com/jsr377/jsr377-tck
https://github.com/jsr377/jsr377-converters

If you're using any of the plugins from https://github.com/griffon-plugins then you may quickly realize your application may not work. Griffon 3.x has broken binary compatibility in some areas to retrofit the JSR377 API and to ensure there are no split packages, paving the way for embracing the Java Platform Module System.

Cheers,
Andres
Reply | Threaded
Open this post in threaded view
|

Re: The "illegal reflective access" warnings on Java 9+ and Griffon

zlatinb
Hi Andres

Thanks for the response.  Unfortunately upgrading to Guice 4.2.3 did not get rid of the warning.  

For the time being I've been able to get rid of all warning by using the "--add-opens" switch when launching the application.  It's less than ideal but it works, and should continue to work for at least a few upcoming Java releases.

If anyone else is having this issue, you can get rid of the Guice warning by adding:

--add-opens java.base/java.lang=ALL-UNNAMED

In my case that caused the warning to move somewhere in the swing packages; so I had to set

--illegal-access=debug

and chase down all such illegal accesses.  I ended up opening a whole bunch of packages, but my application now runs free from warnings :)

Regarding Griffon 3.x, I don't believe I'm using any plugins, unless lazybones uses them with the default templates.  The urgency for me is gone for at least a few years so I will probably just wait until Griffon 3.x is released.

Thanks again
Zlatin