langtools/src/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java
changeset 22163 3651128c74eb
parent 14545 2e7bab0639b8
child 24897 655b72d7b96e
equal deleted inserted replaced
22162:3b3e23e67329 22163:3651128c74eb
   111      */
   111      */
   112     public JavacPathFileManager(Context context, boolean register, Charset charset) {
   112     public JavacPathFileManager(Context context, boolean register, Charset charset) {
   113         super(charset);
   113         super(charset);
   114         if (register)
   114         if (register)
   115             context.put(JavaFileManager.class, this);
   115             context.put(JavaFileManager.class, this);
   116         pathsForLocation = new HashMap<Location, PathsForLocation>();
   116         pathsForLocation = new HashMap<>();
   117         fileSystems = new HashMap<Path,FileSystem>();
   117         fileSystems = new HashMap<>();
   118         setContext(context);
   118         setContext(context);
   119     }
   119     }
   120 
   120 
   121     /**
   121     /**
   122      * Set the context for JavacPathFileManager.
   122      * Set the context for JavacPathFileManager.
   153     public ClassLoader getClassLoader(Location location) {
   153     public ClassLoader getClassLoader(Location location) {
   154         nullCheck(location);
   154         nullCheck(location);
   155         Iterable<? extends Path> path = getLocation(location);
   155         Iterable<? extends Path> path = getLocation(location);
   156         if (path == null)
   156         if (path == null)
   157             return null;
   157             return null;
   158         ListBuffer<URL> lb = new ListBuffer<URL>();
   158         ListBuffer<URL> lb = new ListBuffer<>();
   159         for (Path p: path) {
   159         for (Path p: path) {
   160             try {
   160             try {
   161                 lb.append(p.toUri().toURL());
   161                 lb.append(p.toUri().toURL());
   162             } catch (MalformedURLException e) {
   162             } catch (MalformedURLException e) {
   163                 throw new AssertionError(e);
   163                 throw new AssertionError(e);
   306         nullCheck(kinds);
   306         nullCheck(kinds);
   307 
   307 
   308         Iterable<? extends Path> paths = getLocation(location);
   308         Iterable<? extends Path> paths = getLocation(location);
   309         if (paths == null)
   309         if (paths == null)
   310             return List.nil();
   310             return List.nil();
   311         ListBuffer<JavaFileObject> results = new ListBuffer<JavaFileObject>();
   311         ListBuffer<JavaFileObject> results = new ListBuffer<>();
   312 
   312 
   313         for (Path path : paths)
   313         for (Path path : paths)
   314             list(path, packageName, kinds, recurse, results);
   314             list(path, packageName, kinds, recurse, results);
   315 
   315 
   316         return results.toList();
   316         return results.toList();
   392     @Override
   392     @Override
   393     public Iterable<? extends JavaFileObject> getJavaFileObjectsFromPaths(
   393     public Iterable<? extends JavaFileObject> getJavaFileObjectsFromPaths(
   394         Iterable<? extends Path> paths) {
   394         Iterable<? extends Path> paths) {
   395         ArrayList<PathFileObject> result;
   395         ArrayList<PathFileObject> result;
   396         if (paths instanceof Collection<?>)
   396         if (paths instanceof Collection<?>)
   397             result = new ArrayList<PathFileObject>(((Collection<?>)paths).size());
   397             result = new ArrayList<>(((Collection<?>)paths).size());
   398         else
   398         else
   399             result = new ArrayList<PathFileObject>();
   399             result = new ArrayList<>();
   400         for (Path p: paths)
   400         for (Path p: paths)
   401             result.add(PathFileObject.createSimplePathFileObject(this, nullCheck(p)));
   401             result.add(PathFileObject.createSimplePathFileObject(this, nullCheck(p)));
   402         return result;
   402         return result;
   403     }
   403     }
   404 
   404