Page 1 of 1

Illegal refelctive access in SDK

Posted: Wed Jan 20, 2021 2:03 am
by sderrick
I see the following warnings when starting our application that uses the SDK

WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by ro.sync.ui.qe (file:/home/scott/Desktop/ide/oxygen-22.0.0.0.jar) to field javax.swing.text.DefaultHighlighter.highlights
WARNING: Please consider reporting this to the maintainers of ro.sync.ui.qe
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

Is this fixed in the latest release?

thanks,

Scott

Re: Illegal refelctive access in SDK

Posted: Fri Jan 22, 2021 11:24 am
by adrian
Hello,

The "illegal reflective access operation" warnings appear when running Oxygen with Java 9 and later. Oxygen relies on reflection to set up some hooks and handlers in the Java VM (e.g. URL handlers), so these illegal reflective access operations are currently unavoidable.
So, no, this isn't something that needs fixing at this time. They are just warning messages.
It's possible that future versions of Java will deny these operations by default, but you will most likely still be able to allow them with the Java argument

Code: Select all

--illegal-access=permit
This was discussed here on the forum. Please see Radu's comment here:
post57823.html#p57823

Regards,
Adrian

Re: Illegal refelctive access in SDK

Posted: Fri Jan 22, 2021 6:42 pm
by sderrick
Adrian,

Normally I start our app with java.exe -jar mbep-editor-2.0.jar

I tried java.exe --illegal-access=permit -jar mbep-editor-2.0.jar

Unrecognized option: --illegal-access=permit
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

thanks,

Scott

Re: Illegal refelctive access in SDK

Posted: Mon Jan 25, 2021 1:21 pm
by adrian
Hi,

The "--illegal-access=permit" argument is only available for Java 9 and later. It doesn't change anything at this time for Java 9 - 15 since this is the default, so it's unnecessary.

What version of Java is that?
java -version or java --version

Regards,
Adrian