sun.nio.ch.DirectBuffer and jdk9/jigsaw

Vitaly Davidovich vitalyd at gmail.com
Wed Feb 22 13:46:19 UTC 2017


Hi all,

What's the status of this interface with respect to Java 9 (and beyond)? It
wasn't added to the critical API list of JEP 260, and thus requires an
addExports flag to grant access.  I have a use case where just the
address() method is used in performance sensitive code.  Previously, the
code had used a JNI call to get the address of a DirectByteBuffer, but
address() has superior performance particularly because the JIT
devirtualizes all callsites I have (they only see DBB as receivers of this
call).

So, has the fate of this interface been decided? Am I stuck with addExports
for Java 9? Is there a medium/long term replacement? Just to reiterate, I'd
like access to the address() with as little fuss as possible, and don't
care about the attachment() and cleaner() methods on it.

Also, let me know if this best addressed to the nio-dev mailing list - it
*is* an NIO class, but my question is really geared towards working with
this interface in the modular/jigsaw world.

Thanks


More information about the jigsaw-dev mailing list