diff -r 2c33418a6d57 -r 83b611b88ac8 jdk/test/java/util/ServiceLoader/modules/Basic.java --- a/jdk/test/java/util/ServiceLoader/modules/Basic.java Thu Apr 06 17:01:03 2017 +0000 +++ b/jdk/test/java/util/ServiceLoader/modules/Basic.java Fri Apr 07 08:05:54 2017 +0000 @@ -34,7 +34,6 @@ import java.lang.module.Configuration; import java.lang.module.ModuleFinder; -import java.lang.reflect.Layer; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -229,7 +228,7 @@ */ @Test public void testWithCustomLayer1() { - Layer layer = createCustomLayer("bananascript"); + ModuleLayer layer = createCustomLayer("bananascript"); ClassLoader loader = layer.findLoader("bananascript"); List providers @@ -258,7 +257,7 @@ */ @Test public void testWithCustomLayer2() { - Layer layer = createCustomLayer("bananascript"); + ModuleLayer layer = createCustomLayer("bananascript"); List factories = collectAll(ServiceLoader.load(layer, ScriptEngineFactory.class)); @@ -293,7 +292,7 @@ */ @Test public void testWithCustomLayer3() { - Layer bootLayer = Layer.boot(); + ModuleLayer bootLayer = ModuleLayer.boot(); Configuration cf0 = bootLayer.configuration(); // boot layer should contain "bananascript" @@ -313,12 +312,12 @@ // layer1 Configuration cf1 = cf0.resolveAndBind(finder, ModuleFinder.of(), Set.of()); - Layer layer1 = bootLayer.defineModulesWithOneLoader(cf1, scl); + ModuleLayer layer1 = bootLayer.defineModulesWithOneLoader(cf1, scl); assertTrue(layer1.modules().size() == 1); // layer2 Configuration cf2 = cf0.resolveAndBind(finder, ModuleFinder.of(), Set.of()); - Layer layer2 = bootLayer.defineModulesWithOneLoader(cf2, scl); + ModuleLayer layer2 = bootLayer.defineModulesWithOneLoader(cf2, scl); assertTrue(layer2.modules().size() == 1); // layer3 with layer1 and layer2 as parents @@ -326,7 +325,8 @@ List.of(cf1, cf2), ModuleFinder.of(), Set.of()); - Layer layer3 = Layer.defineModulesWithOneLoader(cf3, List.of(layer1, layer2), scl).layer(); + ModuleLayer layer3 + = ModuleLayer.defineModulesWithOneLoader(cf3, List.of(layer1, layer2), scl).layer(); assertTrue(layer3.modules().size() == 1); @@ -390,12 +390,12 @@ @Test(expectedExceptions = { NullPointerException.class }) public void testLoadNull3() { class S { } - ServiceLoader.load((Layer) null, S.class); + ServiceLoader.load((ModuleLayer) null, S.class); } @Test(expectedExceptions = { NullPointerException.class }) public void testLoadNull4() { - ServiceLoader.load(Layer.empty(), null); + ServiceLoader.load(ModuleLayer.empty(), null); } @Test(expectedExceptions = { NullPointerException.class }) @@ -404,19 +404,19 @@ } /** - * Create a custom Layer by resolving the given module names. The modules + * Create a custom layer by resolving the given module names. The modules * are located in the {@code ${test.classes}/modules} directory. */ - private Layer createCustomLayer(String... modules) { + private ModuleLayer createCustomLayer(String... modules) { Path dir = Paths.get(System.getProperty("test.classes", "."), "modules"); ModuleFinder finder = ModuleFinder.of(dir); Set roots = new HashSet<>(); Collections.addAll(roots, modules); - Layer bootLayer = Layer.boot(); + ModuleLayer bootLayer = ModuleLayer.boot(); Configuration parent = bootLayer.configuration(); Configuration cf = parent.resolve(finder, ModuleFinder.of(), roots); ClassLoader scl = ClassLoader.getSystemClassLoader(); - Layer layer = bootLayer.defineModulesWithOneLoader(cf, scl); + ModuleLayer layer = bootLayer.defineModulesWithOneLoader(cf, scl); assertTrue(layer.modules().size() == 1); return layer; }