756 assertTrue(b.canRead(unnamed)); 757 testsReadsAll(c, layer); 758 } 759 760 761 /** 762 * Test miscellaneous methods. 763 */ 764 public void testMisc() throws IOException { 765 Path dir = Files.createTempDirectory(USER_DIR, "mods"); 766 Path m_jar = createDummyJarFile(dir.resolve("m.jar"), "p/T.class"); 767 768 ModuleFinder finder = ModuleFinder.of(m_jar); 769 770 assertTrue(finder.find("m").isPresent()); 771 ModuleDescriptor m = finder.find("m").get().descriptor(); 772 773 // test miscellaneous methods 774 assertTrue(m.isAutomatic()); 775 assertFalse(m.modifiers().contains(ModuleDescriptor.Modifier.SYNTHETIC)); 776 assertFalse(m.osName().isPresent()); 777 assertFalse(m.osArch().isPresent()); 778 assertFalse(m.osVersion().isPresent()); 779 } 780 781 782 /** 783 * Invokes parent.resolve to resolve the given root modules. 784 */ 785 static Configuration resolve(Configuration parent, 786 ModuleFinder finder, 787 String... roots) { 788 return parent.resolve(finder, ModuleFinder.of(), Set.of(roots)); 789 } 790 791 /** 792 * Finds a module in the given configuration or its parents, returning 793 * the module descriptor (or null if not found) 794 */ 795 static ModuleDescriptor findDescriptor(Configuration cf, String name) { 796 Optional<ResolvedModule> om = cf.findModule(name); 797 if (om.isPresent()) { 798 return om.get().reference().descriptor(); | 756 assertTrue(b.canRead(unnamed)); 757 testsReadsAll(c, layer); 758 } 759 760 761 /** 762 * Test miscellaneous methods. 763 */ 764 public void testMisc() throws IOException { 765 Path dir = Files.createTempDirectory(USER_DIR, "mods"); 766 Path m_jar = createDummyJarFile(dir.resolve("m.jar"), "p/T.class"); 767 768 ModuleFinder finder = ModuleFinder.of(m_jar); 769 770 assertTrue(finder.find("m").isPresent()); 771 ModuleDescriptor m = finder.find("m").get().descriptor(); 772 773 // test miscellaneous methods 774 assertTrue(m.isAutomatic()); 775 assertFalse(m.modifiers().contains(ModuleDescriptor.Modifier.SYNTHETIC)); 776 } 777 778 779 /** 780 * Invokes parent.resolve to resolve the given root modules. 781 */ 782 static Configuration resolve(Configuration parent, 783 ModuleFinder finder, 784 String... roots) { 785 return parent.resolve(finder, ModuleFinder.of(), Set.of(roots)); 786 } 787 788 /** 789 * Finds a module in the given configuration or its parents, returning 790 * the module descriptor (or null if not found) 791 */ 792 static ModuleDescriptor findDescriptor(Configuration cf, String name) { 793 Optional<ResolvedModule> om = cf.findModule(name); 794 if (om.isPresent()) { 795 return om.get().reference().descriptor(); |