|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
@@ -73,19 +73,13 @@ public void run() {
|
73 | 73 | Configuration cf = parent.configuration().resolve(finder, ModuleFinder.of(), Set.of("mymod"));
|
74 | 74 | ClassLoader scl = ClassLoader.getSystemClassLoader();
|
75 | 75 | ModuleLayer.Controller controller = ModuleLayer.defineModulesWithOneLoader(cf, List.of(parent), scl);
|
76 |
| - // Remove reflection once JDK 22 is minimum. See JDK-8340004. |
77 |
| - Method enableNativeAccessMethod = ModuleLayer.Controller.class.getMethod("enableNativeAccess", Module.class); |
78 | 76 | ModuleLayer layer = controller.layer();
|
79 | 77 | ClassLoader moduleClassLoader = layer.findLoader("mymod");
|
80 | 78 | Class appClass = moduleClassLoader.loadClass("javafx.application.Application");
|
81 | 79 | Class webClass = moduleClassLoader.loadClass("javafx.scene.web.WebView");
|
82 |
| - // Remove reflection once JDK 22 is minimum. See JDK-8340004. |
83 |
| - //controller.enableNativeAccess(webClass.getModule()); |
84 |
| - enableNativeAccessMethod.invoke(controller, new Object[]{webClass.getModule()}); |
| 80 | + controller.enableNativeAccess(webClass.getModule()); |
85 | 81 | Class testClass = moduleClassLoader.loadClass("myapp7.DataUrlWithModuleLayer");
|
86 |
| - // Remove reflection once JDK 22 is minimum. See JDK-8340004. |
87 |
| - //controller.enableNativeAccess(appClass.getModule()); |
88 |
| - enableNativeAccessMethod.invoke(controller, new Object[]{appClass.getModule()}); |
| 82 | + controller.enableNativeAccess(appClass.getModule()); |
89 | 83 | Method launchMethod = appClass.getMethod("launch", Class.class, String[].class);
|
90 | 84 | launchMethod.invoke(null, new Object[]{testClass, args});
|
91 | 85 | System.exit(DataUrlWithModuleLayer.ERROR_UNEXPECTED_EXIT);
|
|
0 commit comments