71 " System.out.println(\"MyReference!\"); " + 72 " } " + 73 " public MyReference(String mystring) { " + 74 " super(mystring); " + 75 " } " + 76 "}"; 77 ClassFileInstaller.writeClassToDisk("mypackage/MyReference", 78 InMemoryJavaCompiler.compile("mypackage.MyReference", source2), 79 classDir); 80 81 JarBuilder.build("myjavanaming", "mypackage/MyReference"); 82 appJar = TestCommon.getTestJar("myjavanaming.jar"); 83 84 System.out.println("Test dumping with --patch-module"); 85 OutputAnalyzer output = 86 TestCommon.dump(appJar, 87 TestCommon.list("javax/naming/Reference", "mypackage/MyReference"), 88 "--patch-module=java.naming=" + moduleJar, 89 "-Xlog:class+load", 90 "PatchMain", "javax.naming.Reference", "mypackage.MyReference"); 91 TestCommon.checkDump(output, "Loading classes to share"); 92 93 String classPath = appJar + File.pathSeparator + classDir; 94 System.out.println("classPath: " + classPath); 95 TestCommon.run( 96 "-XX:+UnlockDiagnosticVMOptions", 97 "-cp", classPath, 98 "--patch-module=java.naming=" + moduleJar, 99 "-Xlog:class+load", 100 "PatchMain", "javax.naming.Reference", "mypackage.MyReference") 101 .assertNormalExit( 102 "I pass!", 103 "MyReference source: file:"); 104 } 105 } | 71 " System.out.println(\"MyReference!\"); " + 72 " } " + 73 " public MyReference(String mystring) { " + 74 " super(mystring); " + 75 " } " + 76 "}"; 77 ClassFileInstaller.writeClassToDisk("mypackage/MyReference", 78 InMemoryJavaCompiler.compile("mypackage.MyReference", source2), 79 classDir); 80 81 JarBuilder.build("myjavanaming", "mypackage/MyReference"); 82 appJar = TestCommon.getTestJar("myjavanaming.jar"); 83 84 System.out.println("Test dumping with --patch-module"); 85 OutputAnalyzer output = 86 TestCommon.dump(appJar, 87 TestCommon.list("javax/naming/Reference", "mypackage/MyReference"), 88 "--patch-module=java.naming=" + moduleJar, 89 "-Xlog:class+load", 90 "PatchMain", "javax.naming.Reference", "mypackage.MyReference"); 91 output.shouldHaveExitValue(1) 92 .shouldContain("Cannot use the following option when dumping the shared archive: --patch-module"); 93 94 String classPath = appJar + File.pathSeparator + classDir; 95 System.out.println("classPath: " + classPath); 96 TestCommon.run( 97 "-XX:+UnlockDiagnosticVMOptions", 98 "-cp", classPath, 99 "--patch-module=java.naming=" + moduleJar, 100 "-Xlog:class+load", 101 "PatchMain", "javax.naming.Reference", "mypackage.MyReference") 102 .assertSilentlyDisabledCDS(0, "MyReference source: file:", "I pass!"); 103 } 104 } |