8306431: File.listRoots method description should be re-examined

Reviewed-by: bpb, alanb
This commit is contained in:
Nagata-Haruhito 2023-06-08 07:03:29 +00:00 committed by Alan Bateman
parent 5af9d2a0ac
commit 9d64a9d220
2 changed files with 17 additions and 13 deletions

View file

@ -1813,17 +1813,26 @@ public class File
* <p> A particular Java platform may support zero or more
* hierarchically-organized file systems. Each file system has a
* {@code root} directory from which all other files in that file system
* can be reached. Windows platforms, for example, have a root directory
* for each active drive; UNIX platforms have a single root directory,
* namely {@code "/"}. The set of available filesystem roots is affected
* by various system-level operations such as the insertion or ejection of
* removable media and the disconnecting or unmounting of physical or
* virtual disk drives.
* can be reached.
*
* <p> This method returns an array of {@code File} objects that denote the
* root directories of the available filesystem roots. It is guaranteed
* that the canonical pathname of any file physically present on the local
* machine will begin with one of the roots returned by this method.
* There is no guarantee that a root directory can be accessed.
*
* <p> Unlike most methods in this class, this method does not throw
* security exceptions. If a security manager exists and its {@link
* SecurityManager#checkRead(String)} method denies read access to a
* particular root directory, then that directory will not appear in the
* result.
*
* @implNote
* Windows platforms, for example, have a root directory
* for each active drive; UNIX platforms have a single root directory,
* namely {@code "/"}. The set of filesystem roots is affected
* by various system-level operations such as the disconnecting or
* unmounting of physical or virtual disk drives.
*
* <p> The canonical pathname of a file that resides on some other machine
* and is accessed via a remote-filesystem protocol such as SMB or NFS may
@ -1835,12 +1844,6 @@ public class File
* platform will be returned by this method, while {@code File} objects
* containing UNC pathnames will not be returned by this method.
*
* <p> Unlike most methods in this class, this method does not throw
* security exceptions. If a security manager exists and its {@link
* SecurityManager#checkRead(String)} method denies read access to a
* particular root directory, then that directory will not appear in the
* result.
*
* @return An array of {@code File} objects denoting the available
* filesystem roots, or {@code null} if the set of roots could not
* be determined. The array will be empty if there are no