RFR: 8293910: tools/launcher/FXLauncherTest.java fail with jfx [v2]

Alan Bateman alanb at openjdk.org
Wed Sep 21 07:13:55 UTC 2022


On Sat, 17 Sep 2022 04:03:35 GMT, Leslie Zhai <lzhai at openjdk.org> wrote:

>> Hi,
>> 
>> @dumasun reported the issue:
>> 
>> Configured with jfx-ls-modular-sdk:
>> 
>> 
>> configure --with-import-modules=modular-sdk
>> 
>> 
>> `make run-test CONF=fastdebug TEST="tools/launcher/FXLauncherTest.java"` failed:
>> 
>> 
>> ----------System.err:(11/697)----------
>> java.lang.RuntimeException: JavaFX modules erroneously included in the JDK
>>     at FXLauncherTest.main(FXLauncherTest.java:451)
>>     at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
>>     at java.base/java.lang.reflect.Method.invoke(Method.java:578)
>>     at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
>>     at java.base/java.lang.Thread.run(Thread.java:1589)
>> 
>> JavaTest Message: Test threw exception: java.lang.RuntimeException: JavaFX modules erroneously included in the JDK
>> JavaTest Message: shutting down test
>> 
>> STATUS:Failed.`main' threw exception: java.lang.RuntimeException: JavaFX modules erroneously included in the JDK
>> 
>> 
>> Thanks,
>> Leslie Zhai
>
> Leslie Zhai has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8293910: Try --upgrade-module-path and --patch-module but still failed

The --patch-module option is used to override or add classes/resources in the module, it doesn't override the module definition. I see you tried --upgrade-module-path too but you've set the value to IMPORT_MODULE_DIR and it's not clear what this means in this test.

Can you try this, I think this should do what you want:


--- a/test/jdk/tools/launcher/FXLauncherTest.java
+++ b/test/jdk/tools/launcher/FXLauncherTest.java
@@ -223,7 +223,7 @@ public class FXLauncherTest extends TestHelper {
         compileFXModule();
 
         List<String> fxCompilerArgs = new ArrayList<>();
-        fxCompilerArgs.add("--module-path=" + MODULE_DIR);
+        fxCompilerArgs.add("--upgrade-module-path=" + MODULE_DIR);
         fxCompilerArgs.add("--add-modules=javafx.graphics");
         fxCompilerArgs.addAll(Arrays.asList(compilerArgs));
         compile(fxCompilerArgs.toArray(new String[fxCompilerArgs.size()]));
@@ -232,7 +232,7 @@ public class FXLauncherTest extends TestHelper {
     static TestResult doFxExec(String...cmds) {
         List<String> fxCmds = new ArrayList<>();
         fxCmds.addAll(Arrays.asList(cmds));
-        fxCmds.add(1, "--module-path=" + MODULE_DIR);
+        fxCmds.add(1, "--upgrade-module-path=" + MODULE_DIR);
         fxCmds.add(2, "--add-modules=javafx.graphics");
         return doExec(fxCmds.toArray(new String[fxCmds.size()]));
     }
@@ -439,18 +439,6 @@ public class FXLauncherTest extends TestHelper {
     }
 
     public static void main(String... args) throws Exception {
-
-        // Ensure that FX is not part of jdk
-        Class<?> fxClass = null;
-        try {
-            fxClass = Class.forName(FX_MARKER_CLASS);
-        } catch (ClassNotFoundException ex) {
-            // do nothing
-        }
-        if (fxClass != null) {
-            throw new RuntimeException("JavaFX modules erroneously included in the JDK");
-        }
-
         FXLauncherTest fxt = new FXLauncherTest();
         fxt.run(args);
         if (testExitValue > 0) {

-------------

PR: https://git.openjdk.org/jdk/pull/10299


More information about the core-libs-dev mailing list