Skip to content

Compilation failure on branch-4.17: ConcurrentLongHashMap uses Java record but the branch targets Java 8 #4777

@eolivelli

Description

@eolivelli

Description

Branch branch-4.17 fails to compile after commit 0e1bddd ([Fix] ConcurrentLongHashMap throw ArrayIndexOutOfBoundsException, #4771) was backported to it.

The commit introduces a Java record declaration in ConcurrentLongHashMap:

private record Table<V>(long[] keys, V[] values, int capacity) { }

The record keyword requires Java 16+, but on branch-4.17 the root pom.xml sets:

<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>

so the file fails to parse.

Build error

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.12.1:compile (default-compile) on project bookkeeper-server: Compilation failure: Compilation failure:
[ERROR] .../ConcurrentLongHashMap.java:[320,29] ';' expected
[ERROR] .../ConcurrentLongHashMap.java:[320,32] illegal start of type

Affected branches

  • branch-4.17 — broken (Java 8 target).
  • master — not affected (Java 17 target).

Proposed fix

Replace the record with an equivalent static final nested class exposing keys(), values() and capacity() accessors, preserving the existing call sites.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions