RFR: 8264400: (fs) WindowsFileStore equality depends on how the FileStore was constructed [v4]

Alan Bateman alanb at openjdk.java.net
Thu Apr 8 16:56:08 UTC 2021


On Thu, 8 Apr 2021 16:37:39 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Please consider this change to make `sun.nio.fs.WindowsFileStore.equals()` return `true` if the root strings of the two objects are equal under case insensitive comparison, and the two `WindowsFileStore`s have the same volume information.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8264400: Clean up equals() and hashCode()

src/java.base/windows/classes/sun/nio/fs/WindowsFileStore.java line 56:

> 54: 
> 55:     private int hashCode = 0;
> 56: 

Good, I think this is safe and equals/hashCode are consistent. I suspect we can extend this to other (maybe all) volume type but it needs a bit more exploration. Minor nit is that you can't need to initialise hashCode to 0.

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

PR: https://git.openjdk.java.net/jdk/pull/3279


More information about the nio-dev mailing list