langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java
changeset 41155 93dad90c22c1
parent 40762 f8883aa0053c
child 41254 08f8dbf7741e
equal deleted inserted replaced
41154:ed8625a2f0f1 41155:93dad90c22c1
   128     static final Path javaHome = FileSystems.getDefault().getPath(System.getProperty("java.home"));
   128     static final Path javaHome = FileSystems.getDefault().getPath(System.getProperty("java.home"));
   129     static final Path thisSystemModules = javaHome.resolve("lib").resolve("modules");
   129     static final Path thisSystemModules = javaHome.resolve("lib").resolve("modules");
   130 
   130 
   131     Map<Path, FileSystem> fileSystems = new LinkedHashMap<>();
   131     Map<Path, FileSystem> fileSystems = new LinkedHashMap<>();
   132     List<Closeable> closeables = new ArrayList<>();
   132     List<Closeable> closeables = new ArrayList<>();
       
   133     private Map<String,String> fsEnv = Collections.emptyMap();
   133 
   134 
   134     Locations() {
   135     Locations() {
   135         initHandlers();
   136         initHandlers();
   136     }
   137     }
   137 
   138 
   203             } else {
   204             } else {
   204                 entries.add(getPath(s));
   205                 entries.add(getPath(s));
   205             }
   206             }
   206         }
   207         }
   207         return entries;
   208         return entries;
       
   209     }
       
   210 
       
   211     public void setMultiReleaseValue(String multiReleaseValue) {
       
   212         fsEnv = Collections.singletonMap("multi-release", multiReleaseValue);
   208     }
   213     }
   209 
   214 
   210     /**
   215     /**
   211      * Utility class to help evaluate a path option. Duplicate entries are ignored, jar class paths
   216      * Utility class to help evaluate a path option. Duplicate entries are ignored, jar class paths
   212      * can be expanded.
   217      * can be expanded.
  1045                     }
  1050                     }
  1046                     return null;
  1051                     return null;
  1047                 }
  1052                 }
  1048 
  1053 
  1049                 if (p.getFileName().toString().endsWith(".jar") && fsInfo.exists(p)) {
  1054                 if (p.getFileName().toString().endsWith(".jar") && fsInfo.exists(p)) {
  1050                     try (FileSystem fs = FileSystems.newFileSystem(p, null)) {
  1055                     URI uri = URI.create("jar:" + p.toUri());
       
  1056                     try (FileSystem fs = FileSystems.newFileSystem(uri, fsEnv, null)) {
  1051                         Path moduleInfoClass = fs.getPath("module-info.class");
  1057                         Path moduleInfoClass = fs.getPath("module-info.class");
  1052                         if (Files.exists(moduleInfoClass)) {
  1058                         if (Files.exists(moduleInfoClass)) {
  1053                             String moduleName = readModuleName(moduleInfoClass);
  1059                             String moduleName = readModuleName(moduleInfoClass);
  1054                             return new Pair<>(moduleName, p);
  1060                             return new Pair<>(moduleName, p);
  1055                         }
  1061                         }