lundi 9 novembre 2020

Toolkit Reflective access warning to StartUpWMClassName

I am creating an IDE (its opensource, have a look) ,

Main Window

so in order to change the StartUpWMClassName on Linux,

I have used this code:

Toolkit toolkit = Toolkit.getDefaultToolkit();
java.lang.reflect.Field field = toolkit.getClass().getDeclaredField("awtAppClassName");
field.setAccessible(true);
field.set(toolkit, "Omega IDE");

And this generates this Warning during runtime:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by ide.Screen (file:/usr/bin/Omega%20IDE.jar) to field sun.awt.X11.XToolkit.awtAppClassName
WARNING: Please consider reporting this to the maintainers of ide.Screen
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 there another way to do the same without having any warning and also without using System.setProperty("--illegal-access", "permit"))?





Aucun commentaire:

Enregistrer un commentaire