From bac8b320435f7e78931c7a6d208cb5caab9026ca Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Fri, 3 Jan 2025 10:42:42 -0800 Subject: [PATCH] Fix equality and hashcode of CancelServerStreamCommand. (#11785) In e036b1b198bfa2eb5fbdd27fc02a5df95ecd939b, CancelServerStreamCommand got another field. But, its hashCode and equals methods were not updated. --- .../java/io/grpc/netty/CancelServerStreamCommand.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/netty/src/main/java/io/grpc/netty/CancelServerStreamCommand.java b/netty/src/main/java/io/grpc/netty/CancelServerStreamCommand.java index d49e3bd672b..a3b29457670 100644 --- a/netty/src/main/java/io/grpc/netty/CancelServerStreamCommand.java +++ b/netty/src/main/java/io/grpc/netty/CancelServerStreamCommand.java @@ -69,13 +69,14 @@ public boolean equals(Object o) { CancelServerStreamCommand that = (CancelServerStreamCommand) o; - return Objects.equal(this.stream, that.stream) - && Objects.equal(this.reason, that.reason); + return this.stream.equals(that.stream) + && this.reason.equals(that.reason) + && this.peerNotify.equals(that.peerNotify); } @Override public int hashCode() { - return Objects.hashCode(stream, reason); + return Objects.hashCode(stream, reason, peerNotify); } @Override @@ -83,6 +84,7 @@ public String toString() { return MoreObjects.toStringHelper(this) .add("stream", stream) .add("reason", reason) + .add("peerNotify", peerNotify) .toString(); }