RFR: 8365626: (fs) Improve handling of broken links in Files.isSameFile() (win)
Alan Bateman
alanb at openjdk.org
Fri Sep 5 17:06:09 UTC 2025
On Fri, 5 Sep 2025 15:35:47 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> Methods such as Files.readAttributes will return a WindowsFileAttributes object so can't have equals accessing the file system. The API docs don't specify the equality of XXFileAttributes. If specified it would likely be specified based on the value of the snapshot, not just the file key.
>
>> Files.readAttributes will return a WindowsFileAttributes object so can't have equals accessing the file system.
>
> I don't see where `equals` is accessing the file system. It invokes `WindowsFileAttributes.isSameFile` which uses the volume serial number and file index. Or maybe I missed the point of this comment.
Okay, but the concern is that user code may be stashing XXFileAttribute objects into collections so we can't have equals/hashCode be based solely on the file key when that is only reliable when the file is open. Also equality is problematic when the timestamps or other values aren't equal.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27079#discussion_r2325619421
More information about the nio-dev
mailing list