RFR: 8365626: (fs) Improve handling of broken links in Files.isSameFile() (win)
Brian Burkhalter
bpb at openjdk.org
Fri Sep 5 17:37:09 UTC 2025
On Fri, 5 Sep 2025 17:03:37 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>>> 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.
I'll change it to work without `equals`. I don't think it's essential.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27079#discussion_r2325679532
More information about the nio-dev
mailing list