RFR: 8191963: Path.equals() and File.equals() return true for two different files on Windows

Brian Burkhalter bpb at openjdk.org
Mon Sep 29 18:57:17 UTC 2025


On Thu, 12 Jun 2025 21:12:53 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Replace logic in `java.io.WinNTFileSystems.compare(File,File)` with that from `sun.nio.fs.WindowsPath.compareTo(Path)`.

> [I]t's not clear to me whether, using the strings alone, anything substantively different could be done.

It's still unclear to me what else could be done for this issue, especially given the `File.equals` specification:

On UNIX systems, alphabetic case is significant in comparing pathnames; on
Microsoft Windows systems it is not. 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.

We are bound to case insensitivity and not accessing the file system, unless the specification were to change.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/25788#issuecomment-3348584647


More information about the core-libs-dev mailing list