squah-confluent commented on code in PR #19678:
URL: https://github.com/apache/kafka/pull/19678#discussion_r2085134123


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/assignor/RangeSet.java:
##########
@@ -44,6 +44,7 @@ public RangeSet(int from, int to) {
 
     @Override
     public int size() {
+        if (to < from) return 0;
         return to - from;

Review Comment:
   We can go with `return Math.max(0, to - from);` as long as we guarantee that 
ranges can't be larger than Integer.MAX_VALUE. I think ranges that large have 
unclear behavior anyway, so I will forbid them in the constructor.



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to