Hi Enrico,
java.io.FileDescriptor is a public class, part of public API. There's
one version for JVMs running on UNIX-based OSes and another for JVMs
running on Windows. Both contain int field 'fd'. But you already know
that if you access this field using reflection. Now instead of doing
this in Java and then passing the numberic 'fd' down to native code, you
could pass the whole FileDescriptor object to native code and access the
field using JNI. There's no restriction imposed by Jigsaw in JNI.
Regards, Peter
On 05/08/2017 03:16 PM, Enrico Olivelli wrote:
Hi,
I am trying to port a project (Apache BookKeeper) to Java9, actually
this code uses reflection in order to access the 'fd' field of the
FileDescriptor class.
We have to access that ID in order to call low level native functions
See
https://github.com/apache/bookkeeper/blob/master/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/NativeIO.java
# getSysFileDescriptor
Is there any way to access the FD handle without using reflecttion ?
If not, is it possibile to enhance the FileDescriptor API in order to
given access to the internal "fd" field ?
Thank you
Enrico Olivelli