This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase-thirdparty.git


The following commit(s) were added to refs/heads/master by this push:
     new 16577b5  HBASE-29942 Addendum remove enum usage in 
CodedInputStream.newInstance
16577b5 is described below

commit 16577b5aad0a47d03c2a0b62c3c738a52995c349
Author: Duo Zhang <[email protected]>
AuthorDate: Sat Mar 7 10:52:04 2026 +0800

    HBASE-29942 Addendum remove enum usage in CodedInputStream.newInstance
    
    This may cause class loading error because of recursive dependencies
    between ByteString and CodedInputStream.
    See HBASE-29971 for more details.
---
 .../src/main/patches/HBASE-15789.patch             | 37 +++++++++++++++++++---
 .../src/main/patches/HBASE-17239.patch             |  4 +--
 2 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/hbase-shaded-protobuf/src/main/patches/HBASE-15789.patch 
b/hbase-shaded-protobuf/src/main/patches/HBASE-15789.patch
index 4565a03..ee6a4ae 100644
--- a/hbase-shaded-protobuf/src/main/patches/HBASE-15789.patch
+++ b/hbase-shaded-protobuf/src/main/patches/HBASE-15789.patch
@@ -13,7 +13,7 @@ index e7d9eec8e..e17fefd39 100644
      byte[] buffer = getBuffer();
 diff --git a/src/main/java/com/google/protobuf/ByteInput.java 
b/src/main/java/com/google/protobuf/ByteInput.java
 new file mode 100644
-index 000000000..190aac07b
+index 000000000..8fa95a213
 --- /dev/null
 +++ b/src/main/java/com/google/protobuf/ByteInput.java
 @@ -0,0 +1,86 @@
@@ -372,10 +372,37 @@ index 900f98850..6789cafdf 100644
 
    /**
 diff --git a/src/main/java/com/google/protobuf/CodedInputStream.java 
b/src/main/java/com/google/protobuf/CodedInputStream.java
-index 0d68d1797..1cfd5765d 100644
+index 0d68d1797..08b61797b 100644
 --- a/src/main/java/com/google/protobuf/CodedInputStream.java
 +++ b/src/main/java/com/google/protobuf/CodedInputStream.java
-@@ -200,6 +200,15 @@ public abstract class CodedInputStream {
+@@ -122,20 +122,12 @@ public abstract class CodedInputStream {
+   /** Create a new CodedInputStream wrapping the given byte array slice. */
+   static CodedInputStream newInstance(
+       final byte[] buf, final int off, final int len, final boolean 
bufferIsImmutable) {
+-    final ArrayDecoder result;
+-    switch (varintExperiment) {
+-      case NEW_ALL_CASES:
+-        result = new ArrayDecoderNewVarintAllCases(buf, off, len, 
bufferIsImmutable);
+-        break;
+-      case NEW_TAGS_LENGTHS_UNSIGNED_ONLY:
+-        result = new ArrayDecoderNewVarintTagsLengthsOnly(buf, off, len, 
bufferIsImmutable);
+-        break;
+-      case CONTROL:
+-      default:
+-        result = new ArrayDecoderOldVarint(buf, off, len, bufferIsImmutable);
+-        break;
+-    }
+-
++    // Using VarintExperiment here may cause class loading error because of 
recursive loading, as
++    // the initialization for ByteString.EMPTY will call this method and 
loading CodedInputStream
++    // also needs ByteString.EMPTY. So here we just simply the code to always 
use the old varint
++    // implementation. Should be changed to other implementation if future 
protobuf release changes
++    // the default implementation.
++    final ArrayDecoder result = new ArrayDecoderOldVarint(buf, off, len, 
bufferIsImmutable);
+     try {
+       // Some uses of CodedInputStream can be more efficient if they know
+       // exactly how many bytes are available.  By pushing the end point of 
the
+@@ -200,6 +192,15 @@ public abstract class CodedInputStream {
      }
    }
 
@@ -391,7 +418,7 @@ index 0d68d1797..1cfd5765d 100644
    /** Disable construction/inheritance outside of this class. */
    private CodedInputStream() {}
 
-@@ -2605,4 +2614,652 @@ public abstract class CodedInputStream {
+@@ -2605,4 +2606,652 @@ public abstract class CodedInputStream {
        }
      }
    }
@@ -1045,7 +1072,7 @@ index 0d68d1797..1cfd5765d 100644
 +  }
  }
 diff --git a/src/main/java/com/google/protobuf/Utf8.java 
b/src/main/java/com/google/protobuf/Utf8.java
-index 5abe89dc2..60a4de572 100644
+index 5abe89dc2..0d0af5097 100644
 --- a/src/main/java/com/google/protobuf/Utf8.java
 +++ b/src/main/java/com/google/protobuf/Utf8.java
 @@ -122,6 +122,10 @@ final class Utf8 {
diff --git a/hbase-shaded-protobuf/src/main/patches/HBASE-17239.patch 
b/hbase-shaded-protobuf/src/main/patches/HBASE-17239.patch
index 1c521fc..0317460 100644
--- a/hbase-shaded-protobuf/src/main/patches/HBASE-17239.patch
+++ b/hbase-shaded-protobuf/src/main/patches/HBASE-17239.patch
@@ -1,8 +1,8 @@
 diff --git a/src/main/java/com/google/protobuf/CodedInputStream.java 
b/src/main/java/com/google/protobuf/CodedInputStream.java
-index 1cfd5765d..3308cebdd 100644
+index 08b61797b..09294cbab 100644
 --- a/src/main/java/com/google/protobuf/CodedInputStream.java
 +++ b/src/main/java/com/google/protobuf/CodedInputStream.java
-@@ -201,11 +201,7 @@ public abstract class CodedInputStream {
+@@ -193,11 +193,7 @@ public abstract class CodedInputStream {
    }
 
    /** Create a new CodedInputStream wrapping the given {@link ByteInput}. */

Reply via email to