jdk/test/tools/jmod/hashes/HashesTest.java
changeset 43712 5dfd0950317c
parent 43109 fe275140c3f1
child 45191 ba48b1679390
equal deleted inserted replaced
43619:dc9102c475f3 43712:5dfd0950317c
   310         // hash is recorded in m1 and not any other packaged modules on module path
   310         // hash is recorded in m1 and not any other packaged modules on module path
   311         ht.checkHashes("m1", "m2");
   311         ht.checkHashes("m1", "m2");
   312         assertTrue(ht.hashes("m2") == null);
   312         assertTrue(ht.hashes("m2") == null);
   313 
   313 
   314         // should not override any JDK packaged modules
   314         // should not override any JDK packaged modules
   315         ModuleFinder finder = new ModulePath(Runtime.version(),
   315         ModuleFinder finder = ModulePath.of(Runtime.version(), true, mpath);
   316                                              true,
       
   317                                              mpath);
       
   318         assertTrue(ht.hashes(finder,"jdk.compiler") == null);
   316         assertTrue(ht.hashes(finder,"jdk.compiler") == null);
   319         assertTrue(ht.hashes(finder,"jdk.attach") == null);
   317         assertTrue(ht.hashes(finder,"jdk.attach") == null);
   320     }
   318     }
   321 
   319 
   322     private void checkHashes(String mn, String... hashModules) throws IOException {
   320     private void checkHashes(String mn, String... hashModules) throws IOException {
   323         ModuleHashes hashes = hashes(mn);
   321         ModuleHashes hashes = hashes(mn);
   324         assertTrue(hashes.names().equals(Set.of(hashModules)));
   322         assertTrue(hashes.names().equals(Set.of(hashModules)));
   325     }
   323     }
   326 
   324 
   327     private ModuleHashes hashes(String name) {
   325     private ModuleHashes hashes(String name) {
   328         ModuleFinder finder = new ModulePath(Runtime.version(),
   326         ModuleFinder finder = ModulePath.of(Runtime.version(), true, lib);
   329                                              true,
       
   330                                              lib);
       
   331         return hashes(finder, name);
   327         return hashes(finder, name);
   332     }
   328     }
   333 
   329 
   334     private ModuleHashes hashes(ModuleFinder finder, String name) {
   330     private ModuleHashes hashes(ModuleFinder finder, String name) {
   335         ModuleReference mref = finder.find(name).orElseThrow(RuntimeException::new);
   331         ModuleReference mref = finder.find(name).orElseThrow(RuntimeException::new);