diff --git a/build.xml b/build.xml
index 3f9fecb6c77a..bd646f9e0c4f 100644
--- a/build.xml
+++ b/build.xml
@@ -308,6 +308,7 @@
--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.base/java.nio.file.attribute=ALL-UNNAMED
--add-opens java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED
diff --git a/test/unit/org/apache/cassandra/index/sai/SAITester.java b/test/unit/org/apache/cassandra/index/sai/SAITester.java
index d1d46d1f7c18..ce82c9fafd66 100644
--- a/test/unit/org/apache/cassandra/index/sai/SAITester.java
+++ b/test/unit/org/apache/cassandra/index/sai/SAITester.java
@@ -92,6 +92,7 @@
import org.apache.cassandra.service.StorageService;
import org.apache.cassandra.service.snapshot.TableSnapshot;
import org.apache.cassandra.utils.FBUtilities;
+import org.apache.cassandra.utils.ReflectionUtils;
import org.apache.cassandra.utils.Throwables;
import org.apache.lucene.codecs.CodecUtil;
import org.awaitility.Awaitility;
@@ -898,7 +899,7 @@ protected static void setSegmentWriteBufferSpace(final int segmentSize) throws E
NamedMemoryLimiter limiter = (NamedMemoryLimiter) V1OnDiskFormat.class.getDeclaredField("SEGMENT_BUILD_MEMORY_LIMITER").get(null);
Field limitBytes = limiter.getClass().getDeclaredField("limitBytes");
limitBytes.setAccessible(true);
- Field modifiersField = Field.class.getDeclaredField("modifiers");
+ Field modifiersField = ReflectionUtils.getField(Field.class, "modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(limitBytes, limitBytes.getModifiers() & ~Modifier.FINAL);
limitBytes.set(limiter, segmentSize);
diff --git a/test/unit/org/apache/cassandra/index/sai/SAIUtil.java b/test/unit/org/apache/cassandra/index/sai/SAIUtil.java
index 8f56a0f4ca9b..f7580332077c 100644
--- a/test/unit/org/apache/cassandra/index/sai/SAIUtil.java
+++ b/test/unit/org/apache/cassandra/index/sai/SAIUtil.java
@@ -21,6 +21,7 @@
import java.lang.reflect.Field;
import org.apache.cassandra.index.sai.disk.format.Version;
+import org.apache.cassandra.utils.ReflectionUtils;
public class SAIUtil
{
@@ -31,7 +32,7 @@ public static void setLatestVersion(Version version)
{
latest = Version.class.getDeclaredField("LATEST");
latest.setAccessible(true);
- Field modifiersField = Field.class.getDeclaredField("modifiers");
+ Field modifiersField = ReflectionUtils.getField(Field.class, "modifiers");
modifiersField.setAccessible(true);
latest.set(null, version);
}
diff --git a/test/unit/org/apache/cassandra/index/sai/cql/VectorUpdateDeleteTest.java b/test/unit/org/apache/cassandra/index/sai/cql/VectorUpdateDeleteTest.java
index 5b74719c87fb..97f4bc5ef2f3 100644
--- a/test/unit/org/apache/cassandra/index/sai/cql/VectorUpdateDeleteTest.java
+++ b/test/unit/org/apache/cassandra/index/sai/cql/VectorUpdateDeleteTest.java
@@ -34,6 +34,7 @@
import org.apache.cassandra.index.sai.disk.format.Version;
import org.apache.cassandra.index.sai.disk.vector.VectorMemtableIndex;
import org.apache.cassandra.index.sai.plan.QueryController;
+import org.apache.cassandra.utils.ReflectionUtils;
import static org.apache.cassandra.index.sai.cql.VectorTypeTest.assertContainsInt;
import static org.apache.cassandra.index.sai.disk.vector.CassandraOnHeapGraph.MIN_PQ_ROWS;
diff --git a/test/unit/org/apache/cassandra/index/sai/disk/io/TrackingIndexFileUtils.java b/test/unit/org/apache/cassandra/index/sai/disk/io/TrackingIndexFileUtils.java
index be9bca5c3300..53ed1295e899 100644
--- a/test/unit/org/apache/cassandra/index/sai/disk/io/TrackingIndexFileUtils.java
+++ b/test/unit/org/apache/cassandra/index/sai/disk/io/TrackingIndexFileUtils.java
@@ -29,6 +29,7 @@
import org.apache.cassandra.io.util.FileHandle;
import org.apache.cassandra.io.util.SequentialWriterOption;
+import org.apache.cassandra.utils.ReflectionUtils;
public class TrackingIndexFileUtils extends IndexFileUtils
{
diff --git a/test/unit/org/apache/cassandra/index/sai/memory/TrieMemtableIndexTest.java b/test/unit/org/apache/cassandra/index/sai/memory/TrieMemtableIndexTest.java
index b6995a64ba88..8184bea22c8c 100644
--- a/test/unit/org/apache/cassandra/index/sai/memory/TrieMemtableIndexTest.java
+++ b/test/unit/org/apache/cassandra/index/sai/memory/TrieMemtableIndexTest.java
@@ -67,6 +67,7 @@
import org.apache.cassandra.service.StorageService;
import org.apache.cassandra.utils.FBUtilities;
import org.apache.cassandra.utils.Pair;
+import org.apache.cassandra.utils.ReflectionUtils;
import org.apache.cassandra.utils.bytecomparable.ByteComparable;
import org.apache.cassandra.utils.bytecomparable.ByteSource;
import org.apache.cassandra.utils.concurrent.OpOrder;
@@ -364,7 +365,7 @@ private void setTrieMemtableBufferType(final BufferType newBufferType) throws Ex
{
Field bufferType = TrieMemtable.class.getDeclaredField("BUFFER_TYPE");
bufferType.setAccessible(true);
- Field modifiersField = Field.class.getDeclaredField("modifiers");
+ Field modifiersField = ReflectionUtils.getField(Field.class, "modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(bufferType, bufferType.getModifiers() & ~Modifier.FINAL);
bufferType.set(null, newBufferType);