提交 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 {
}
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 @@ public final class ValueRange implements Serializable {
*/
@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));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册