This is an automated email from the ASF dual-hosted git repository.

reschke pushed a commit to branch OAK-10876
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git

commit 88d3418bd504401e8e75c7838e60cfb75b5a9fd8
Author: Julian Reschke <[email protected]>
AuthorDate: Tue Jun 11 16:28:29 2024 +0100

    OAK-10876: Oak 1.22 does not compile with JDK 11 anymore
---
 .../main/java/org/apache/lucene/store/ByteBufferIndexInput.java  | 9 +++++----
 .../src/main/java/org/apache/lucene/store/NIOFSDirectory.java    | 5 +++--
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git 
a/oak-lucene/src/main/java/org/apache/lucene/store/ByteBufferIndexInput.java 
b/oak-lucene/src/main/java/org/apache/lucene/store/ByteBufferIndexInput.java
index a28151790b..f85c228533 100644
--- a/oak-lucene/src/main/java/org/apache/lucene/store/ByteBufferIndexInput.java
+++ b/oak-lucene/src/main/java/org/apache/lucene/store/ByteBufferIndexInput.java
@@ -27,6 +27,7 @@ package org.apache.lucene.store;
 
 import java.io.EOFException;
 import java.io.IOException;
+import java.nio.Buffer;
 import java.nio.BufferUnderflowException;
 import java.nio.ByteBuffer;
 import java.util.Iterator;
@@ -86,7 +87,7 @@ abstract class ByteBufferIndexInput extends IndexInput {
           throw new EOFException("read past EOF: " + this);
         }
         curBuf = buffers[curBufIndex];
-        curBuf.position(0);
+        ((Buffer) curBuf).position(0);
       } while (!curBuf.hasRemaining());
       return curBuf.get();
     } catch (NullPointerException npe) {
@@ -109,7 +110,7 @@ abstract class ByteBufferIndexInput extends IndexInput {
           throw new EOFException("read past EOF: " + this);
         }
         curBuf = buffers[curBufIndex];
-        curBuf.position(0);
+        ((Buffer) curBuf).position(0);
         curAvail = curBuf.remaining();
       }
       curBuf.get(b, offset, len);
@@ -172,7 +173,7 @@ abstract class ByteBufferIndexInput extends IndexInput {
     final int bi = (int) (pos >> chunkSizePower);
     try {
       final ByteBuffer b = buffers[bi];
-      b.position((int) (pos & chunkSizeMask));
+      ((Buffer) b).position((int) (pos & chunkSizeMask));
       // write values, on exception all is unchanged
       this.curBufIndex = bi;
       this.curBuf = b;
@@ -264,7 +265,7 @@ abstract class ByteBufferIndexInput extends IndexInput {
     }
 
     // set the last buffer's limit for the sliced view.
-    slices[slices.length - 1].limit((int) (sliceEnd & chunkSizeMask));
+    ((Buffer) slices[slices.length - 1]).limit((int) (sliceEnd & 
chunkSizeMask));
     
     return slices;
   }
diff --git 
a/oak-lucene/src/main/java/org/apache/lucene/store/NIOFSDirectory.java 
b/oak-lucene/src/main/java/org/apache/lucene/store/NIOFSDirectory.java
index 6a38ce3234..5248c1b384 100644
--- a/oak-lucene/src/main/java/org/apache/lucene/store/NIOFSDirectory.java
+++ b/oak-lucene/src/main/java/org/apache/lucene/store/NIOFSDirectory.java
@@ -29,6 +29,7 @@ import java.io.File;
 import java.io.EOFException;
 import java.io.IOException;
 import java.io.RandomAccessFile;
+import java.nio.Buffer;
 import java.nio.ByteBuffer;
 import java.nio.channels.ClosedChannelException; // javadoc @link
 import java.nio.channels.FileChannel;
@@ -157,7 +158,7 @@ public class NIOFSDirectory extends FSDirectory {
         // Use our own pre-wrapped byteBuf:
         assert byteBuf != null;
         bb = byteBuf;
-        byteBuf.clear().position(offset);
+        ((Buffer) byteBuf).clear().position(offset);
       } else {
         bb = ByteBuffer.wrap(b, offset, len);
       }
@@ -172,7 +173,7 @@ public class NIOFSDirectory extends FSDirectory {
         int readLength = len;
         while (readLength > 0) {
           final int toRead = Math.min(CHUNK_SIZE, readLength);
-          bb.limit(bb.position() + toRead);
+          ((Buffer) bb).limit(bb.position() + toRead);
           assert bb.remaining() == toRead;
           final int i = channel.read(bb, pos);
           if (i < 0) { // be defensive here, even though we checked before 
hand, something could have changed

Reply via email to