Skip to content

Commit 01f12fb

Browse files
committed
8266631: StandardJavaFileManager: getJavaFileObjects() impl violates the spec
8266596: StandardJavaFileManager: default impls of setLocationFromPaths(), getJavaFileObjectsFromPaths() methods don't throw IllegalArgumentException as specified 8266591: StandardJavaFileManager::getJavaFileObjectsFromPaths() methods contain a typo in their spec 8266590: StandardJavaFileManager::setLocationFromPaths() spec contains an error Reviewed-by: vromero, jjg
1 parent 6b14c8a commit 01f12fb

1 file changed

Lines changed: 21 additions & 15 deletions

File tree

src/java.compiler/share/classes/javax/tools/StandardJavaFileManager.java

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -190,16 +190,16 @@ Iterable<? extends JavaFileObject> getJavaFileObjectsFromFiles(
190190
* Returns file objects representing the given paths.
191191
*
192192
* @implSpec
193-
* The default implementation converts each path to a file and calls
194-
* {@link #getJavaFileObjectsFromFiles getJavaObjectsFromFiles}.
195-
* IllegalArgumentException will be thrown if any of the paths
196-
* cannot be converted to a file.
193+
* The default implementation lazily converts each path to a file and calls
194+
* {@link #getJavaFileObjectsFromFiles(Iterable) getJavaFileObjectsFromFiles}.
195+
* {@code IllegalArgumentException} will be thrown
196+
* if any of the paths cannot be converted to a file at the point the conversion happens.
197197
*
198198
* @param paths a list of paths
199199
* @return a list of file objects
200200
* @throws IllegalArgumentException if the list of paths includes
201201
* a directory or if this file manager does not support any of the
202-
* given paths.
202+
* given paths
203203
*
204204
* @since 13
205205
*/
@@ -212,10 +212,10 @@ default Iterable<? extends JavaFileObject> getJavaFileObjectsFromPaths(
212212
* Returns file objects representing the given paths.
213213
*
214214
* @implSpec
215-
* The default implementation converts each path to a file and calls
216-
* {@link #getJavaFileObjectsFromFiles getJavaObjectsFromFiles}.
217-
* IllegalArgumentException will be thrown if any of the paths
218-
* cannot be converted to a file.
215+
* The default implementation lazily converts each path to a file and calls
216+
* {@link #getJavaFileObjectsFromPaths(Collection) getJavaFileObjectsFromPaths}.
217+
* {@code IllegalArgumentException} will be thrown
218+
* if any of the paths cannot be converted to a file at the point the conversion happens.
219219
*
220220
* @param paths a list of paths
221221
* @return a list of file objects
@@ -248,7 +248,8 @@ default Iterable<? extends JavaFileObject> getJavaFileObjectsFromPaths(
248248
* @param files an array of files
249249
* @return a list of file objects
250250
* @throws IllegalArgumentException if the array of files includes
251-
* a directory
251+
* a directory or if this file manager does not support any of the
252+
* given paths
252253
* @throws NullPointerException if the given array contains null
253254
* elements
254255
*/
@@ -262,10 +263,15 @@ default Iterable<? extends JavaFileObject> getJavaFileObjectsFromPaths(
262263
* getJavaFileObjectsFromPaths({@linkplain java.util.Arrays#asList Arrays.asList}(paths))
263264
* </pre>
264265
*
266+
* @implSpec
267+
* The default implementation will only throw {@code NullPointerException}
268+
* if {@linkplain #getJavaFileObjectsFromPaths(Collection)} throws it.
269+
*
265270
* @param paths an array of paths
266271
* @return a list of file objects
267272
* @throws IllegalArgumentException if the array of files includes
268-
* a directory
273+
* a directory or if this file manager does not support any of the
274+
* given paths
269275
* @throws NullPointerException if the given array contains null
270276
* elements
271277
*
@@ -332,10 +338,10 @@ void setLocation(Location location, Iterable<? extends File> files)
332338
* will be cancelled.
333339
*
334340
* @implSpec
335-
* The default implementation converts each path to a file and calls
336-
* {@link #getJavaFileObjectsFromFiles getJavaObjectsFromFiles}.
337-
* {@linkplain IllegalArgumentException IllegalArgumentException}
338-
* will be thrown if any of the paths cannot be converted to a file.
341+
* The default implementation lazily converts each path to a file and calls
342+
* {@link #setLocation setLocation}.
343+
* {@code IllegalArgumentException} will be thrown if any of the paths cannot
344+
* be converted to a file at the point the conversion happens.
339345
*
340346
* @param location a location
341347
* @param paths a list of paths, if {@code null} use the default

0 commit comments

Comments
 (0)