From 87868e982e14e7c2abfb27299b90a4f57a8500f7 Mon Sep 17 00:00:00 2001 From: Enrico Olivelli Date: Thu, 7 May 2026 07:10:59 +0200 Subject: [PATCH] [Fix] Replace Java record with nested class in ConcurrentLongHashMap (#4777) branch-4.17 targets Java 8, but #4771 introduced a Java `record` declaration in ConcurrentLongHashMap.Section, which requires Java 16+. This breaks the build with: ConcurrentLongHashMap.java:[320,29] ';' expected ConcurrentLongHashMap.java:[320,32] illegal start of type Replace the record with an equivalent `static final` nested class exposing keys(), values() and capacity() accessors so the existing call sites are unchanged. --- .../collections/ConcurrentLongHashMap.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/collections/ConcurrentLongHashMap.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/collections/ConcurrentLongHashMap.java index 2b716664806..461949f6dfc 100644 --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/collections/ConcurrentLongHashMap.java +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/collections/ConcurrentLongHashMap.java @@ -317,7 +317,29 @@ public interface EntryProcessor { // previous design had to paper over with Math.min(keys.length, values.length). @SuppressWarnings("serial") private static final class Section extends StampedLock { - private record Table(long[] keys, V[] values, int capacity) { } + private static final class Table { + 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")