Register JNI and Reflection classes for AWT/Swing on Linux #5466
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.