You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2026/03/09 17:45:39 UTC

(lucene) branch main updated: Add 4-arg map override to FilterFileChannel (#15801)

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

mayya pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/main by this push:
     new f7b35cb32d8 Add 4-arg map override to FilterFileChannel (#15801)
f7b35cb32d8 is described below

commit f7b35cb32d8b6bdc3bc3954a5db233d6ed72a702
Author: Mayya Sharipova <ma...@elastic.co>
AuthorDate: Mon Mar 9 13:45:34 2026 -0400

    Add 4-arg map override to FilterFileChannel (#15801)
    
    Java 22 added FileChannel.map(MapMode, long, long, Arena) which
    returns MemorySegment. The base FileChannel class provides a default
    implementation that throws UnsupportedOperationException. Without
    this override, any wrapped FileChannel based on FilterFileChannel
    would fail when the 4-arg map variant is called.
---
 .../java/org/apache/lucene/tests/mockfile/FilterFileChannel.java   | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lucene/test-framework/src/java/org/apache/lucene/tests/mockfile/FilterFileChannel.java b/lucene/test-framework/src/java/org/apache/lucene/tests/mockfile/FilterFileChannel.java
index 3f8ed3bc361..ab9cc58f7ac 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/tests/mockfile/FilterFileChannel.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/tests/mockfile/FilterFileChannel.java
@@ -17,6 +17,8 @@
 package org.apache.lucene.tests.mockfile;
 
 import java.io.IOException;
+import java.lang.foreign.Arena;
+import java.lang.foreign.MemorySegment;
 import java.nio.ByteBuffer;
 import java.nio.MappedByteBuffer;
 import java.nio.channels.FileChannel;
@@ -118,6 +120,11 @@ public abstract class FilterFileChannel extends FileChannel {
     return delegate.map(mode, position, size);
   }
 
+  @Override
+  public MemorySegment map(MapMode mode, long offset, long size, Arena arena) throws IOException {
+    return delegate.map(mode, offset, size, arena);
+  }
+
   @Override
   public FileLock lock(long position, long size, boolean shared) throws IOException {
     return delegate.lock(position, size, shared);