< prev index next >

jdk/test/tools/jmod/hashes/HashesTest.java

Print this page

        

@@ -25,12 +25,11 @@
  * @test
  * @summary Test the recording and checking of module hashes
  * @author Andrei Eremeev
  * @library /lib/testlibrary
  * @modules java.base/jdk.internal.module
- *          jdk.jlink/jdk.tools.jlink.internal
- *          jdk.jlink/jdk.tools.jmod
+ *          jdk.jlink
  *          jdk.compiler
  * @build CompilerUtils
  * @run testng HashesTest
  */
 

@@ -51,20 +50,25 @@
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
 import java.util.Set;
+import java.util.spi.ToolProvider;
 import java.util.stream.Collectors;
 
 import jdk.internal.module.ConfigurableModuleFinder;
 import jdk.internal.module.ModuleHashes;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
 
 import static org.testng.Assert.*;
 
 public class HashesTest {
+    static final ToolProvider JMOD_TOOL = ToolProvider.findFirst("jmod")
+        .orElseThrow(() ->
+            new RuntimeException("jmod tool not found")
+        );
 
     private final Path testSrc = Paths.get(System.getProperty("test.src"));
     private final Path modSrc = testSrc.resolve("src");
     private final Path mods = Paths.get("mods");
     private final Path jmods = Paths.get("jmods");

@@ -202,11 +206,11 @@
 
         runJmod(args);
     }
 
     private void runJmod(List<String> args) {
-        int rc = jdk.tools.jmod.Main.run(args.toArray(new String[args.size()]), System.out);
+        int rc = JMOD_TOOL.run(System.out, System.out, args.toArray(new String[args.size()]));
         System.out.println("jmod options: " + args.stream().collect(Collectors.joining(" ")));
         if (rc != 0) {
             throw new AssertionError("Jmod failed: rc = " + rc);
         }
     }
< prev index next >