< prev index next >

test/hotspot/jtreg/runtime/modules/PatchModule/PatchModuleDupModule.java

Print this page
*** 21,11 ***
   * questions.
   */
  
  /*
   * @test
!  * @summary Module system initialization exception results if a module is specificed twice to --patch-module.
   * @requires vm.flagless
   * @modules java.base/jdk.internal.misc
   * @library /test/lib
   * @run driver PatchModuleDupModule
   */
--- 21,11 ---
   * questions.
   */
  
  /*
   * @test
!  * @summary If a module is specificed twice to --patch-module, it should print an error
   * @requires vm.flagless
   * @modules java.base/jdk.internal.misc
   * @library /test/lib
   * @run driver PatchModuleDupModule
   */

*** 33,18 ***
  import jdk.test.lib.process.OutputAnalyzer;
  import jdk.test.lib.process.ProcessTools;
  
  public class PatchModuleDupModule {
  
-   // The module system initialization should generate an ExceptionInInitializerError
    // if --patch-module is specified with the same module more than once.
  
    public static void main(String args[]) throws Exception {
      ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
        "--patch-module=module_one=module_one_dir",
        "--patch-module=module_one=module_one_dir",
        "-version");
      OutputAnalyzer output = new OutputAnalyzer(pb.start());
!     output.shouldContain("java.lang.ExceptionInInitializerError");
      output.shouldHaveExitValue(1);
    }
  }
--- 33,18 ---
  import jdk.test.lib.process.OutputAnalyzer;
  import jdk.test.lib.process.ProcessTools;
  
  public class PatchModuleDupModule {
  
    // if --patch-module is specified with the same module more than once.
+   // The launcher should print an error.
  
    public static void main(String args[]) throws Exception {
      ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
        "--patch-module=module_one=module_one_dir",
        "--patch-module=module_one=module_one_dir",
        "-version");
      OutputAnalyzer output = new OutputAnalyzer(pb.start());
!     output.shouldContain("Cannot specify a module more than once to --patch-module");
      output.shouldHaveExitValue(1);
    }
  }
< prev index next >