siddharthaDevineni commented on code in PR #21601:
URL: https://github.com/apache/kafka/pull/21601#discussion_r2866833336


##########
clients/src/main/java/org/apache/kafka/common/utils/Bytes.java:
##########
@@ -146,57 +161,32 @@ private static String toString(final byte[] b, int off, 
int len) {
      *
      * @param input - The byte array to increment
      * @return A new copy of the incremented byte array.
+     * @deprecated This method is not part of the public API and will be 
removed in version 5.0.
+     *             Internal Kafka code should use {@link 
org.apache.kafka.common.utils.internals.BytesUtils#increment(Bytes)} instead.
      */
+    @Deprecated(since = "4.3", forRemoval = true)
     public static Bytes increment(Bytes input) throws 
IndexOutOfBoundsException {
-        byte[] inputArr = input.get();
-        byte[] ret = new byte[inputArr.length];
-        int carry = 1;
-        for (int i = inputArr.length - 1; i >= 0; i--) {
-            if (inputArr[i] == (byte) 0xFF && carry == 1) {
-                ret[i] = (byte) 0x00;
-            } else {
-                ret[i] = (byte) (inputArr[i] + carry);
-                carry = 0;
-            }
-        }
-        if (carry == 0) {
-            return wrap(ret);
-        } else {
-            throw new IndexOutOfBoundsException();
-        }
+        return BytesUtils.increment(input);
     }
 
     /**
      * A byte array comparator based on lexicograpic ordering.
+     * @deprecated This field is not part of the public API and will be 
removed in version 5.0.
+     *             Internal Kafka code should use {@link 
org.apache.kafka.common.utils.internals.BytesUtils#BYTES_LEXICO_COMPARATOR} 
instead.
      */
-    public static final ByteArrayComparator BYTES_LEXICO_COMPARATOR = new 
LexicographicByteArrayComparator();
+    @Deprecated(since = "4.3", forRemoval = true)
+    public static final BytesUtils.ByteArrayComparator BYTES_LEXICO_COMPARATOR 
= new LexicographicByteArrayComparator();

Review Comment:
   yeah, that would be a breaking change, thanks again :)



-- 
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