Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8267569: java.io.File.equals contains misleading Javadoc
Reviewed-by: alanb, dfuchs, bchristi, naoto
  • Loading branch information
Brian Burkhalter committed Jun 2, 2021
1 parent 508cec7 commit 56b65e4
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/java.base/share/classes/java/io/File.java
Expand Up @@ -2221,8 +2221,8 @@ public static File createTempFile(String prefix, String suffix)
/**
* 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
Expand All @@ -2242,16 +2242,23 @@ public int compareTo(File pathname) {
/**
* 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) {
Expand Down

1 comment on commit 56b65e4

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.