equal
deleted
inserted
replaced
100 }, |
100 }, |
101 REVERSE { |
101 REVERSE { |
102 public int compare(File f1, File f2) { |
102 public int compare(File f1, File f2) { |
103 return -f1.getName().compareTo(f2.getName()); |
103 return -f1.getName().compareTo(f2.getName()); |
104 } |
104 } |
105 }; |
105 } |
106 }; |
106 } |
|
107 |
107 protected SortFiles sortFiles; |
108 protected SortFiles sortFiles; |
108 |
109 |
109 /** |
110 /** |
110 * Register a Context.Factory to create a JavacFileManager. |
111 * Register a Context.Factory to create a JavacFileManager. |
111 */ |
112 */ |
177 { |
178 { |
178 return getJavaFileForOutput(CLASS_OUTPUT, classname, kind, sibling); |
179 return getJavaFileForOutput(CLASS_OUTPUT, classname, kind, sibling); |
179 } |
180 } |
180 |
181 |
181 public Iterable<? extends JavaFileObject> getJavaFileObjectsFromStrings(Iterable<String> names) { |
182 public Iterable<? extends JavaFileObject> getJavaFileObjectsFromStrings(Iterable<String> names) { |
182 ListBuffer<File> files = new ListBuffer<File>(); |
183 ListBuffer<File> files = new ListBuffer<>(); |
183 for (String name : names) |
184 for (String name : names) |
184 files.append(new File(nullCheck(name))); |
185 files.append(new File(nullCheck(name))); |
185 return getJavaFileObjectsFromFiles(files.toList()); |
186 return getJavaFileObjectsFromFiles(files.toList()); |
186 } |
187 } |
187 |
188 |
443 } |
444 } |
444 } |
445 } |
445 |
446 |
446 /** A directory of zip files already opened. |
447 /** A directory of zip files already opened. |
447 */ |
448 */ |
448 Map<File, Archive> archives = new HashMap<File,Archive>(); |
449 Map<File, Archive> archives = new HashMap<>(); |
449 |
450 |
450 private static final String[] symbolFileLocation = { "lib", "ct.sym" }; |
451 private static final String[] symbolFileLocation = { "lib", "ct.sym" }; |
451 private static final RelativeDirectory symbolFilePrefix |
452 private static final RelativeDirectory symbolFilePrefix |
452 = new RelativeDirectory("META-INF/sym/rt.jar/"); |
453 = new RelativeDirectory("META-INF/sym/rt.jar/"); |
453 |
454 |
590 public ClassLoader getClassLoader(Location location) { |
591 public ClassLoader getClassLoader(Location location) { |
591 nullCheck(location); |
592 nullCheck(location); |
592 Iterable<? extends File> path = getLocation(location); |
593 Iterable<? extends File> path = getLocation(location); |
593 if (path == null) |
594 if (path == null) |
594 return null; |
595 return null; |
595 ListBuffer<URL> lb = new ListBuffer<URL>(); |
596 ListBuffer<URL> lb = new ListBuffer<>(); |
596 for (File f: path) { |
597 for (File f: path) { |
597 try { |
598 try { |
598 lb.append(f.toURI().toURL()); |
599 lb.append(f.toURI().toURL()); |
599 } catch (MalformedURLException e) { |
600 } catch (MalformedURLException e) { |
600 throw new AssertionError(e); |
601 throw new AssertionError(e); |
616 |
617 |
617 Iterable<? extends File> path = getLocation(location); |
618 Iterable<? extends File> path = getLocation(location); |
618 if (path == null) |
619 if (path == null) |
619 return List.nil(); |
620 return List.nil(); |
620 RelativeDirectory subdirectory = RelativeDirectory.forPackage(packageName); |
621 RelativeDirectory subdirectory = RelativeDirectory.forPackage(packageName); |
621 ListBuffer<JavaFileObject> results = new ListBuffer<JavaFileObject>(); |
622 ListBuffer<JavaFileObject> results = new ListBuffer<>(); |
622 |
623 |
623 for (File directory : path) |
624 for (File directory : path) |
624 listContainer(directory, subdirectory, kinds, recurse, results); |
625 listContainer(directory, subdirectory, kinds, recurse, results); |
625 return results.toList(); |
626 return results.toList(); |
626 } |
627 } |
776 public Iterable<? extends JavaFileObject> getJavaFileObjectsFromFiles( |
777 public Iterable<? extends JavaFileObject> getJavaFileObjectsFromFiles( |
777 Iterable<? extends File> files) |
778 Iterable<? extends File> files) |
778 { |
779 { |
779 ArrayList<RegularFileObject> result; |
780 ArrayList<RegularFileObject> result; |
780 if (files instanceof Collection<?>) |
781 if (files instanceof Collection<?>) |
781 result = new ArrayList<RegularFileObject>(((Collection<?>)files).size()); |
782 result = new ArrayList<>(((Collection<?>)files).size()); |
782 else |
783 else |
783 result = new ArrayList<RegularFileObject>(); |
784 result = new ArrayList<>(); |
784 for (File f: files) |
785 for (File f: files) |
785 result.add(new RegularFileObject(this, nullCheck(f))); |
786 result.add(new RegularFileObject(this, nullCheck(f))); |
786 return result; |
787 return result; |
787 } |
788 } |
788 |
789 |