JDK-8339517 : Add --enable-native-access flag when running tests
  • Type: Bug
  • Component: javafx
  • Sub-Component: other
  • Affected Version: jfx24
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-09-03
  • Updated: 2024-09-19
  • Resolved: 2024-09-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
jfx24 b10Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
JEP 472 [0] is a step along the path to restricting JNI access by default. It was recently integrated into JDK 24 by JDK-8331671.

When running JavaFX applications with JDK 24, we now get illegal access warnings of the following form:

WARNING: A restricted method in java.lang.System has been called
WARNING: java.lang.System::load has been called by com.sun.glass.utils.NativeLib
Loader in module javafx.graphics (file:build/shims/javafx.graphics/)
WARNING: Use --enable-native-access=javafx.graphics to avoid a warning for callers in this module
WARNING: Restricted methods will be blocked in a future release unless native access is enabled

In order to avoid those warnings, and to avoid the eventual errors in the future, we need to pass the --enable-native-access flag when running tests, as follows:

--enable-native-access=javafx.graphics,javafx.media,javafx.web

Note that --enable-access has been implemented at least as far back as JDK 21, so we won't need to qualify the passing of that flag based on the JDK we are using to build and test JavaFX.

[0] https://openjdk.org/jeps/472
Comments
Changeset: 4f1d42af Branch: master Author: Kevin Rushforth <kcr@openjdk.org> Date: 2024-09-13 17:05:54 +0000 URL: https://git.openjdk.org/jfx/commit/4f1d42af38ba494bf083ca3647f9b285f1886cbd
13-09-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jfx/pull/1562 Date: 2024-09-11 14:42:19 +0000
11-09-2024