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

lhotari pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/pulsar.git

commit 62b04fca0ebb1d9548540ed9660e199f99b1e163
Author: Lari Hotari <[email protected]>
AuthorDate: Tue May 5 12:42:17 2026 +0300

    [fix][build][branch-4.0] Fix issue in backporting PR #25644
    
    The backport of #25644 introduced a Java record (`Table<V>`) in
    `ConcurrentLongHashMap`, which fails to compile on branch-4.0 because the
    `pulsar-common` module targets Java 8 source compatibility. Records require
    `-source 16` or higher.
    
    Replace the record with an equivalent static nested final class that exposes
    the same `keys()`, `values()`, and `capacity()` accessors, so all existing
    call sites continue to work unchanged.
---
 .../util/collections/ConcurrentLongHashMap.java    | 24 +++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git 
a/pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/ConcurrentLongHashMap.java
 
b/pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/ConcurrentLongHashMap.java
index 780b6454a1c..23cf94526ea 100644
--- 
a/pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/ConcurrentLongHashMap.java
+++ 
b/pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/ConcurrentLongHashMap.java
@@ -293,7 +293,29 @@ public class ConcurrentLongHashMap<V> {
     // previous design had to paper over with Math.min(keys.length, 
values.length).
     @SuppressWarnings("serial")
     private static final class Section<V> extends StampedLock {
-        private record Table<V>(long[] keys, V[] values, int capacity) { }
+        private static final class Table<V> {
+            private final long[] keys;
+            private final V[] values;
+            private final int capacity;
+
+            Table(long[] keys, V[] values, int capacity) {
+                this.keys = keys;
+                this.values = values;
+                this.capacity = capacity;
+            }
+
+            long[] keys() {
+                return keys;
+            }
+
+            V[] values() {
+                return values;
+            }
+
+            int capacity() {
+                return capacity;
+            }
+        }
 
         // Section is Serializable only by inheritance from StampedLock; never 
actually serialized.
         @SuppressFBWarnings("SE_BAD_FIELD")

Reply via email to