RFR: 8356036: Use Long::hashCode in sun.nio

Chen Liang liach at openjdk.org
Thu May 1 15:37:58 UTC 2025


On Thu, 1 May 2025 14:41:09 GMT, Shaojin Wen <swen at openjdk.org> wrote:

> Similar to #24959 and #24971, sun.nio.ch.FileKey/sun.nio.fs.UnixFileKey/sun.nio.fs.UnixFileStore in java.base can also be simplified similarly.
> 
> Replace manual bitwise operations in hashCode implementations of sun.nio.ch.FileKey/sun.nio.fs.UnixFileKey/sun.nio.fs.UnixFileStore with Long::hashCode.

Confirmed all replaced variables are long. And they are all final long fields, so we can ignore the double field read in race effects (and long even permits tearing reads)

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

Marked as reviewed by liach (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/24987#pullrequestreview-2809997529


More information about the nio-dev mailing list