RFR: 8358537: (bf) JavaNioAccess::getBufferAddress bypasses direct buffer MemorySession state check

Brian Burkhalter bpb at openjdk.org
Tue Jun 3 20:51:30 UTC 2025


On Tue, 3 Jun 2025 20:46:49 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Add package-scope `long java.nio.Buffer::address()` to simply return the value of the `address` instance variable; use this method in `JavaNioAccess::getBufferAddress`.

`Buffer::address` is overridden for heap buffers to throw an `UnsupportedOperationException`. The `MemorySegments` test is modified to remove the use of shared `Arena`s which cause `UnsupportedOperationException`s to be thrown. The `jdk_core` tests have no failures attributable to these changes.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/25631#issuecomment-2937144841


More information about the nio-dev mailing list