diff -r 2efb75c09230 -r 1153fab98d25 langtools/src/java.compiler/share/classes/javax/tools/StandardJavaFileManager.java --- a/langtools/src/java.compiler/share/classes/javax/tools/StandardJavaFileManager.java Wed May 11 20:28:22 2016 +0000 +++ b/langtools/src/java.compiler/share/classes/javax/tools/StandardJavaFileManager.java Thu May 12 11:36:08 2016 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,7 @@ import java.io.IOException; import java.nio.file.Path; import java.util.Arrays; +import java.util.Collection; import static javax.tools.FileManagerUtils.*; @@ -176,7 +177,8 @@ /** * Returns file objects representing the given paths. * - *
The default implementation converts each path to a file and calls + * @implSpec + * The default implementation converts each path to a file and calls * {@link #getJavaFileObjectsFromFiles getJavaObjectsFromFiles}. * IllegalArgumentException will be thrown if any of the paths * cannot be converted to a file. @@ -280,10 +282,21 @@ * Associates the given search path with the given location. Any * previous value will be discarded. * - *
The default implementation converts each path to a file and calls
+ * @apiNote
+ * The type of the {@code paths} parameter is a {@code Collection}
+ * and not {@code Iterable}. This is to prevent the possibility of
+ * accidentally calling the method with a single {@code Path} as
+ * the second argument, because although {@code Path} implements
+ * {@code Iterable
The default implementation throws {@link UnsupportedOperationException} - * for all files.
+ * @implSpec + * The default implementation throws {@link UnsupportedOperationException} + * for all files. * * @param file a file object * @return a path representing the same underlying file system artifact @@ -351,4 +370,36 @@ throw new UnsupportedOperationException(); } + /** + * Factory to create {@code Path} objects from strings. + * + * @since 9 + */ + interface PathFactory { + /** + * Converts a path string, or a sequence of strings that when joined form a path string, to a Path. + * + * @param first the path string or initial part of the path string + * @param more additional strings to be joined to form the path string + * @return the resulting {@code Path} + */ + Path getPath(String first, String... more); + } + + /** + * Specify a factory that can be used to generate a path from a string, or series of strings. + * + * If this method is not called, a factory whose {@code getPath} method is + * equivalent to calling + * {@link java.nio.file.Paths#get(String, String...) java.nio.file.Paths.get(first, more)} + * will be used. + * + * @implSpec + * The default implementation of this method ignores the factory that is provided. + * + * @param f the factory + * + * @since 9 + */ + default void setPathFactory(PathFactory f) { } }