Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8340004

[TestBug] Call ModuleLayer.Controller::enableNativeAccess directly rather than via reflection

XMLWordPrintable

    • b11

      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

            zelmidaoui Ziad El Midaoui
            kcr Kevin Rushforth
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: