racorn commented on issue #6433: MessageId#compare is not symmetric 
(MessageIdImpl, BatchMessageIdImpl)
URL: https://github.com/apache/pulsar/issues/6433#issuecomment-592446852
 
 
   Yes, I could, but I am not sure how `MessageIdImpl` and `BatchMessageIdImpl` 
should compare?
   
   It seems to me that the asymmetry was introduced by purpose with #1285, the 
code reads as
   ```
   } else if (o instanceof MessageIdImpl) {
       int res = super.compareTo(o);
       if (res == 0 && batchIndex > NO_BATCH) {
           return 1;
       } else {
           return res;
       }
   }
   ```
   But as it is now, it breaks the `Comparable` contract, and that makes it 
confusing for user of the client API.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to