8267569: java.io.File.equals contains misleading Javadoc

Reviewed-by: alanb, dfuchs, bchristi, naoto
This commit is contained in:
Brian Burkhalter 2021-06-02 16:33:21 +00:00
parent 508cec7535
commit 56b65e4a8d

View file

@ -2221,8 +2221,8 @@ public class File
/**
* Compares two abstract pathnames lexicographically. The ordering
* defined by this method depends upon the underlying system. On UNIX
* systems, alphabetic case is significant in comparing pathnames; on Microsoft Windows
* systems it is not.
* systems, alphabetic case is significant in comparing pathnames; on
* Microsoft Windows systems it is not.
*
* @param pathname The abstract pathname to be compared to this abstract
* pathname
@ -2242,16 +2242,23 @@ public class File
/**
* Tests this abstract pathname for equality with the given object.
* Returns {@code true} if and only if the argument is not
* {@code null} and is an abstract pathname that denotes the same file
* or directory as this abstract pathname. Whether or not two abstract
* pathnames are equal depends upon the underlying system. On UNIX
* systems, alphabetic case is significant in comparing pathnames; on Microsoft Windows
* systems it is not.
* {@code null} and is an abstract pathname that is the same as this
* abstract pathname. Whether or not two abstract
* pathnames are equal depends upon the underlying operating system.
* On UNIX systems, alphabetic case is significant in comparing pathnames;
* on Microsoft Windows systems it is not.
*
* @apiNote This method only tests whether the abstract pathnames are equal;
* it does not access the file system and the file is not required
* to exist.
*
* @param obj The object to be compared with this abstract pathname
*
* @return {@code true} if and only if the objects are the same;
* {@code false} otherwise
*
* @see #compareTo(File)
* @see java.nio.file.Files#isSameFile(Path,Path)
*/
public boolean equals(Object obj) {
if (obj instanceof File file) {