8179086: java.time.temporal.ValueRange has poor hashCode()
authorigerasim
Fri, 21 Apr 2017 11:40:21 -0700
changeset 44702 df9a5567603a
parent 44701 73cb7afafdff
child 44704 165b88f3d4a8
8179086: java.time.temporal.ValueRange has poor hashCode() Reviewed-by: rriggs
jdk/src/java.base/share/classes/java/time/temporal/ValueRange.java
--- a/jdk/src/java.base/share/classes/java/time/temporal/ValueRange.java	Thu Apr 20 18:40:38 2017 +0200
+++ b/jdk/src/java.base/share/classes/java/time/temporal/ValueRange.java	Fri Apr 21 11:40:21 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));
     }