Jason918 commented on code in PR #18843:
URL: https://github.com/apache/pulsar/pull/18843#discussion_r1045540222


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/BatchMessageIdImpl.java:
##########
@@ -90,30 +91,15 @@ public int hashCode() {
 
     @Override
     public boolean equals(Object o) {
-        if (o instanceof MessageIdImpl) {
-            MessageIdImpl other = (MessageIdImpl) o;
-            int batchIndex = (o instanceof BatchMessageIdImpl) ? 
((BatchMessageIdImpl) o).batchIndex : NO_BATCH;
-            return messageIdEquals(
-                this.ledgerId, this.entryId, this.partitionIndex, 
this.batchIndex,
-                other.ledgerId, other.entryId, other.partitionIndex, batchIndex
-            );
-        } else if (o instanceof TopicMessageIdImpl) {
-            return equals(((TopicMessageIdImpl) o).getInnerMessageId());
+        if (o instanceof MessageId) {
+            return compareTo((MessageId) o) == 0;

Review Comment:
   This will throw an exception if `o` is an instance of `MessageId` but not 
`MessageIdImpl` nor `TopicMessageIdImpl`, like `MultiMessageIdImpl`.
   Before this PR, it just return false.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to