langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java Wed May 11 20:28:22 2016 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java Thu May 12 11:36:08 2016 -0700
@@ -109,6 +109,8 @@
protected boolean symbolFileEnabled;
+ private PathFactory pathFactory = Paths::get;
+
protected enum SortFiles implements Comparator<Path> {
FORWARD {
@Override
@@ -166,6 +168,16 @@
}
}
+ @Override @DefinedBy(DefinedBy.Api.COMPILER)
+ public void setPathFactory(PathFactory f) {
+ pathFactory = Objects.requireNonNull(f);
+ locations.setPathFactory(f);
+ }
+
+ private Path getPath(String first, String... more) {
+ return pathFactory.getPath(first, more);
+ }
+
/**
* Set whether or not to use ct.sym as an alternate to rt.jar.
*/
@@ -199,7 +211,7 @@
public Iterable<? extends JavaFileObject> getJavaFileObjectsFromStrings(Iterable<String> names) {
ListBuffer<Path> paths = new ListBuffer<>();
for (String name : names)
- paths.append(Paths.get(nullCheck(name)));
+ paths.append(getPath(nullCheck(name)));
return getJavaFileObjectsFromPaths(paths.toList());
}
@@ -837,7 +849,7 @@
if (sibling != null && sibling instanceof PathFileObject) {
return ((PathFileObject) sibling).getSibling(baseName);
} else {
- Path p = Paths.get(baseName);
+ Path p = getPath(baseName);
Path real = fsInfo.getCanonicalFile(p);
return PathFileObject.forSimplePath(this, real, p);
}
@@ -855,7 +867,7 @@
try {
if (dir == null) {
- dir = Paths.get(System.getProperty("user.dir"));
+ dir = getPath(System.getProperty("user.dir"));
}
Path path = fileName.resolveAgainst(fsInfo.getCanonicalFile(dir));
return PathFileObject.forDirectoryPath(this, path, dir, fileName);
@@ -918,7 +930,7 @@
@Override @DefinedBy(Api.COMPILER)
public void setLocationFromPaths(Location location,
- Iterable<? extends Path> searchpath)
+ Collection<? extends Path> searchpath)
throws IOException
{
nullCheck(location);