changeset 12415:af9fbf314a38

8179086: java.time.temporal.ValueRange has poor hashCode() Reviewed-by: rriggs
author igerasim
date Tue, 05 Sep 2017 16:14:03 -0700
parents 9cd5ee8b5454
children d205ce402f46
files src/share/classes/java/time/temporal/ValueRange.java
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/time/temporal/ValueRange.java	Fri Sep 01 10:16:09 2017 -0700
+++ b/src/share/classes/java/time/temporal/ValueRange.java	Tue Sep 05 16:14:03 2017 -0700
@@ -385,7 +385,7 @@
         }
         if (obj instanceof ValueRange) {
             ValueRange other = (ValueRange) obj;
-           return minSmallest == other.minSmallest && minLargest == other.minLargest &&
+            return minSmallest == other.minSmallest && minLargest == other.minLargest &&
                    maxSmallest == other.maxSmallest && maxLargest == other.maxLargest;
         }
         return false;
@@ -398,8 +398,9 @@
      */
     @Override
     public int hashCode() {
-        long hash = minSmallest + minLargest << 16 + minLargest >> 48 + maxSmallest << 32 +
-            maxSmallest >> 32 + maxLargest << 48 + maxLargest >> 16;
+        long hash = minSmallest + (minLargest << 16) + (minLargest >> 48) +
+                (maxSmallest << 32) + (maxSmallest >> 32) + (maxLargest << 48) +
+                (maxLargest >> 16);
         return (int) (hash ^ (hash >>> 32));
     }