diff --git a/src/one/nio/mem/MappedFile.java b/src/one/nio/mem/MappedFile.java index 1c3328b..3c9d22b 100755 --- a/src/one/nio/mem/MappedFile.java +++ b/src/one/nio/mem/MappedFile.java @@ -170,6 +170,12 @@ public static long map(RandomAccessFile f, int mode, long start, long size) thro if (map0 != null) { return (long) map0.invoke(f.getChannel(), mode, start, size, false); } + // Since 19 JDK has an extra 'file descriptor' argument + map0 = JavaInternals.getMethod( + cls, "map0", FileDescriptor.class, int.class, long.class, long.class, boolean.class); + if (map0 != null) { + return (long) map0.invoke(f.getFD(), f.getChannel(), mode, start, size, false); + } throw new IllegalStateException("map0 method not found"); } catch (InvocationTargetException e) { Throwable target = e.getTargetException();