From fd4c217254120ec2776e646424f8c30ece343b4f Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Tue, 16 Jan 2024 11:49:43 -0800 Subject: [PATCH] 8323710: (fc) FileChannel.lock creates a FileKey with a poor hashCode after JDK-8321429 (win) --- src/java.base/windows/classes/sun/nio/ch/FileKey.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/java.base/windows/classes/sun/nio/ch/FileKey.java b/src/java.base/windows/classes/sun/nio/ch/FileKey.java index 71959c24ea670..8669517f0c581 100644 --- a/src/java.base/windows/classes/sun/nio/ch/FileKey.java +++ b/src/java.base/windows/classes/sun/nio/ch/FileKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,10 +47,7 @@ public static FileKey create(FileDescriptor fd) throws IOException { @Override public int hashCode() { - int h = dwVolumeSerialNumber; - h = h << 31 + nFileIndexHigh; - h = h << 31 + nFileIndexLow; - return h; + return dwVolumeSerialNumber + nFileIndexHigh + nFileIndexLow; } @Override