提交 c9c47d9b 编写于 作者: I igerasim

8179086: java.time.temporal.ValueRange has poor hashCode()

Reviewed-by: rriggs
上级 ea734953
...@@ -385,7 +385,7 @@ public final class ValueRange implements Serializable { ...@@ -385,7 +385,7 @@ public final class ValueRange implements Serializable {
} }
if (obj instanceof ValueRange) { if (obj instanceof ValueRange) {
ValueRange other = (ValueRange) obj; ValueRange other = (ValueRange) obj;
return minSmallest == other.minSmallest && minLargest == other.minLargest && return minSmallest == other.minSmallest && minLargest == other.minLargest &&
maxSmallest == other.maxSmallest && maxLargest == other.maxLargest; maxSmallest == other.maxSmallest && maxLargest == other.maxLargest;
} }
return false; return false;
...@@ -398,8 +398,9 @@ public final class ValueRange implements Serializable { ...@@ -398,8 +398,9 @@ public final class ValueRange implements Serializable {
*/ */
@Override @Override
public int hashCode() { public int hashCode() {
long hash = minSmallest + minLargest << 16 + minLargest >> 48 + maxSmallest << 32 + long hash = minSmallest + (minLargest << 16) + (minLargest >> 48) +
maxSmallest >> 32 + maxLargest << 48 + maxLargest >> 16; (maxSmallest << 32) + (maxSmallest >> 32) + (maxLargest << 48) +
(maxLargest >> 16);
return (int) (hash ^ (hash >>> 32)); return (int) (hash ^ (hash >>> 32));
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册