diff --git a/CHANGES.txt b/CHANGES.txt index 6b81061a5d..bdda12f603 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,7 @@ 5.1 * Clean up obsolete functions and simplify cql_version handling in cqlsh (CASSANDRA-18787) Merged from 5.0: + * Fix accessing java.nio.Bits.TOTAL_CAPACITY in Java17 (CASSANDRA-18848) * Remove metrics-reporter-config dependency (CASSANDRA-18743) * Fix SAI's SegmentMetadata min and max primary keys (CASSANDRA-18734) * Remove commons-codec dependency (CASSANDRA-18772) diff --git a/build.xml b/build.xml index cad293c716..0eef07847c 100644 --- a/build.xml +++ b/build.xml @@ -262,6 +262,7 @@ --add-opens jdk.compiler/com.sun.tools.javac=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED + --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED diff --git a/conf/jvm17-clients.options b/conf/jvm17-clients.options index 4c12fa378c..57b009f582 100644 --- a/conf/jvm17-clients.options +++ b/conf/jvm17-clients.options @@ -52,6 +52,7 @@ --add-opens jdk.compiler/com.sun.tools.javac=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED +--add-opens java.base/java.nio=ALL-UNNAMED # The newline in the end of file is intentional diff --git a/conf/jvm17-server.options b/conf/jvm17-server.options index 39c1810d16..fb5d4517a6 100644 --- a/conf/jvm17-server.options +++ b/conf/jvm17-server.options @@ -86,6 +86,7 @@ --add-opens jdk.compiler/com.sun.tools.javac=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED +--add-opens java.base/java.nio=ALL-UNNAMED ### GC logging options -- uncomment to enable diff --git a/src/java/org/apache/cassandra/service/GCInspector.java b/src/java/org/apache/cassandra/service/GCInspector.java index 8f922156ca..16b6665c69 100644 --- a/src/java/org/apache/cassandra/service/GCInspector.java +++ b/src/java/org/apache/cassandra/service/GCInspector.java @@ -67,16 +67,7 @@ public class GCInspector implements NotificationListener, GCInspectorMXBean try { Class bitsClass = Class.forName("java.nio.Bits"); - Field f; - try - { - f = bitsClass.getDeclaredField("totalCapacity"); - } - catch (NoSuchFieldException ex) - { - // in Java11 it changed name to "TOTAL_CAPACITY" - f = bitsClass.getDeclaredField("TOTAL_CAPACITY"); - } + Field f = bitsClass.getDeclaredField("TOTAL_CAPACITY"); f.setAccessible(true); temp = f; }