-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Register JNI and Reflection classes for AWT/Swing on Linux #5870
base: master
Are you sure you want to change the base?
Register JNI and Reflection classes for AWT/Swing on Linux #5870
Conversation
The pull request is updated according to the #6088 The common classes used by AWT/Swing application are added for Windows platform as well. Fix #6088 removed substitution for To avoid NPE in For example, running the SwingSet2 native image on Linux where corresponding fontconfig properties files are placed in
There is also an internal system property
For more discussions about |
I have previously set up some stuff for AWT as well, mainly focused on Windows at the time. I do think that the registration handlers should be more granular, as you've combined quite a lot of As for the |
Hey @AlexanderScherbatiy, thanks for the PR. AWT support is of course quite requested and we've been discussing this with @kkriske and others. The problem with a contribution like this is that it adds too much maintenance work for us. The PR neither includes a test case nor is there an easy way to regenerate and validate all these configurations. We believe a better to support AWT is through appropriate declarative, and conditional metadata in the graalvm-reachability-metadata repository. What would be nice is a set of test cases that not only validate the configuration, but can also be extended and then used to regenerate the configuration with the tracing agent. Having this in the metadata repo makes it easy for the community to maintain it. Please feel free to let me know if you like to help with something like this. |
GraalVM provides tracing agent which allows to find JNI and Reflection classes used by an application and store them in configuration files. Using the tracing agent with UI application requires checking non obvious use cases to cover different application code paths: Drag & Drop, file choosers, input dialogs, key strokes, Look & Feels.
Key strokes provide the most vivid use case. AWTKeyStroke.getVKValue(String) method uses reflection to get a key code for for the requested
KeyEvent.VK_*
string value. It requires pressing all keys used as key strokes in the application during the tracing agent usage.The proposed fix registers common classes used by AWT/Swing application on Linux System.
L&F UI classes are registered only for Basic and Metal L&Fs as UIManager.setLookAndFeel(String) method directly sets MetalLookAndFeel class. It is necessary to use the tracing agent when an application uses GTK, Nimbus, and other Look & Feels.