This is an automated email from the ASF dual-hosted git repository.
merlimat pushed a commit to branch branch-4.17
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/branch-4.17 by this push:
new bdf8585a95 [Fix] Replace Java record with nested class in
ConcurrentLongHashMap (#4777) (#4778)
bdf8585a95 is described below
commit bdf8585a95f349c4a2b9b0a18b25ebbafccc6acf
Author: Enrico Olivelli <[email protected]>
AuthorDate: Thu May 7 23:29:57 2026 +0200
[Fix] Replace Java record with nested class in ConcurrentLongHashMap
(#4777) (#4778)
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.
---
.../util/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 2b71666480..461949f6df 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 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")