Experimenting with --add-opens
Simple Java 2D sketch
Further exploration of using --add-opens
in java_args.txt in JRubyArt (should also work with propane). What I have found is that the module org.jruby.dist
is not recognized in my setup (jdk12 and JRuby-9.2.8.0) so instead I tried ALL-UNNAMED
which is what currently applies to the processing and JRubyArt packages anyway.
Quite possibly the reason org.jruby.dist
is not recognized is that headius had yet to grips with naming the automatic module in the jruby.jar
manifest
Running the simple fractions sketch gives the following warning without any java_args.txt
:-
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.headius.backport9.modules.Modules to method java.lang.Object.finalize()
So I added --add-opens java.base/java.lang=ALL-UNNAMED
to java_args.txt
Running fraction this time gives:-
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.headius.backport9.modules.Modules to field java.io.FileDescriptor.fd
So I added --add-opens java.base/java.io=ALL-UNNAMED
then ran sketch again which gave the following warning:-
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.headius.backport9.modules.Modules to method java.awt.Component.paramString()
WARNING: Please consider reporting this to the maintainers of com.headius.backport9.modules.Modules
Finally I added --add-opens java.desktop/java.awt=ALL-UNNAMED
and the sketch ran with no illegal reflective-access warnings. When the JRuby modules are recognized you could be more specific about the modules that require the reflective access. Alternatively once modules are adopted then module-info could specifically open such access.
A P3D sketch
Using the above java_args.txt
I ran my elegant_ball.rb
sketch to get the following warning specific to jogl reflective access:-
WARNING: Illegal reflective access by jogamp.opengl.awt.Java2D$2 to field sun.java2d.opengl.OGLUtilities.UNDEFINED
WARNING: Please consider reporting this to the maintainers of jogamp.opengl.awt.Java2D$2
So I added --add-opens java.desktop/sun.java2d.opengl=ALL-UNNAMED
to java_args.txt and ran the sketch again to get this warning:-
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by jogamp.nativewindow.jawt.JAWTUtil$1 to method sun.awt.SunToolkit.awtLock()
Finally I added --add-opens java.desktop/sun.awt=ALL-UNNAMED
and the sketch ran with no reflective access warning. It should be possible for jogl and JRuby developers to fix these issues by not using reflective access (unlikely) or by creating modules that specifically open the packages to the modules.