jdk/test/java/lang/ClassLoader/getResource/modules/Main.java
changeset 44545 83b611b88ac8
parent 42338 a60f280f803c
equal deleted inserted replaced
44480:2c33418a6d57 44545:83b611b88ac8
    22  */
    22  */
    23 
    23 
    24 import java.io.InputStream;
    24 import java.io.InputStream;
    25 import java.lang.module.Configuration;
    25 import java.lang.module.Configuration;
    26 import java.lang.module.ResolvedModule;
    26 import java.lang.module.ResolvedModule;
    27 import java.lang.reflect.Layer;
       
    28 import java.io.IOException;
    27 import java.io.IOException;
    29 import java.net.URL;
    28 import java.net.URL;
    30 import java.nio.file.Files;
    29 import java.nio.file.Files;
    31 import java.nio.file.Path;
    30 import java.nio.file.Path;
    32 import java.nio.file.Paths;
    31 import java.nio.file.Paths;
   307 
   306 
   308     /**
   307     /**
   309      * Returns the directory for the given module (by name).
   308      * Returns the directory for the given module (by name).
   310      */
   309      */
   311     static Path directoryFor(String mn) {
   310     static Path directoryFor(String mn) {
   312         Configuration cf = Layer.boot().configuration();
   311         Configuration cf = ModuleLayer.boot().configuration();
   313         ResolvedModule resolvedModule = cf.findModule(mn).orElse(null);
   312         ResolvedModule resolvedModule = cf.findModule(mn).orElse(null);
   314         if (resolvedModule == null)
   313         if (resolvedModule == null)
   315             throw new RuntimeException("not found: " + mn);
   314             throw new RuntimeException("not found: " + mn);
   316         Path dir = Paths.get(resolvedModule.reference().location().get());
   315         Path dir = Paths.get(resolvedModule.reference().location().get());
   317         if (!Files.isDirectory(dir))
   316         if (!Files.isDirectory(dir))