JDK-8340004 : [TestBug] Call ModuleLayer.Controller::enableNativeAccess directly rather than via reflection
  • Type: Bug
  • Component: javafx
  • Sub-Component: other
  • Affected Version: jfx24
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-09-12
  • Updated: 2025-04-15
  • Resolved: 2025-03-28
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
jfx25 b11Fixed
Related Reports
Blocks :  
Relates :  
Description
JDK-8339517 updated our tests to run the Java launcher with `--enable-native-access` when running tests to avoid the native access warnings that result from  JEP 472. See JDK-8331671.

We have two tests that dynamically load the JavaFX modules at runtime using a ModuleLayer. Those tests need to call ModuleLayer.Controller::enableNativeAccess to enable native access for the JavaFX modules. This method is a preview feature in JDK 21, so cannot be called directly if we happen to build and test JavaFX with JDK 21. As such, when I added the calls to enableNativeAccess as part of JDK-8339517, I did so using reflection.

Now that we have bumped the minimum JDK to 22 via JDK-8340003, the reflection calls should be replaced with direct calls to enableNativeAccess.

The two files in question are:

tests/system/src/testapp7/java/mymod/myapp7/DataUrlWithModuleLayerLauncher.java
tests/system/src/testapp7/java/mymod/myapp7/LocalStorageAccessWithModuleLayerLauncher.java
Comments
Changeset: ff777c7a Branch: master Author: Ziad El Midaoui <zelmidaoui@openjdk.org> Committer: Kevin Rushforth <kcr@openjdk.org> Date: 2025-03-28 18:13:37 +0000 URL: https://git.openjdk.org/jfx/commit/ff777c7abb0f491152d172f20cfc3dd6d76d5339
28-03-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jfx/pull/1743 Date: 2025-03-25 22:24:51 +0000
25-03-2025