[jdk16] RFR: 8259634: MemorySegment::asByteBuffer does not respect spatial bounds
The byte buffers created from heap segments do not honor the javadoc - which says that the resulting buffer size should be equal to MemorySegment::byteSize, and that the buffer position should be zero. The issue is that the NIO routine we have added to create heap buffers is using the wrong constructor, which doesn't do what we need. The fix is to simply use the proper, more complete constructor. I've also re-enabled an unrelated test which was missing the @Test annotation. ------------- Commit messages: - Fix loic to turn segments into buffers Changes: https://git.openjdk.java.net/jdk16/pull/109/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk16&pr=109&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8259634 Stats: 30 lines in 2 files changed: 28 ins; 0 del; 2 mod Patch: https://git.openjdk.java.net/jdk16/pull/109.diff Fetch: git fetch https://git.openjdk.java.net/jdk16 pull/109/head:pull/109 PR: https://git.openjdk.java.net/jdk16/pull/109
On Tue, 12 Jan 2021 15:28:20 GMT, Maurizio Cimadamore <mcimadamore@openjdk.org> wrote:
The byte buffers created from heap segments do not honor the javadoc - which says that the resulting buffer size should be equal to MemorySegment::byteSize, and that the buffer position should be zero.
The issue is that the NIO routine we have added to create heap buffers is using the wrong constructor, which doesn't do what we need. The fix is to simply use the proper, more complete constructor.
I've also re-enabled an unrelated test which was missing the @Test annotation.
Marked as reviewed by alanb (Reviewer). ------------- PR: https://git.openjdk.java.net/jdk16/pull/109
On Tue, 12 Jan 2021 15:28:20 GMT, Maurizio Cimadamore <mcimadamore@openjdk.org> wrote:
The byte buffers created from heap segments do not honor the javadoc - which says that the resulting buffer size should be equal to MemorySegment::byteSize, and that the buffer position should be zero.
The issue is that the NIO routine we have added to create heap buffers is using the wrong constructor, which doesn't do what we need. The fix is to simply use the proper, more complete constructor.
I've also re-enabled an unrelated test which was missing the @Test annotation.
Marked as reviewed by chegar (Reviewer). ------------- PR: https://git.openjdk.java.net/jdk16/pull/109
On Tue, 12 Jan 2021 15:28:20 GMT, Maurizio Cimadamore <mcimadamore@openjdk.org> wrote:
The byte buffers created from heap segments do not honor the javadoc - which says that the resulting buffer size should be equal to MemorySegment::byteSize, and that the buffer position should be zero.
The issue is that the NIO routine we have added to create heap buffers is using the wrong constructor, which doesn't do what we need. The fix is to simply use the proper, more complete constructor.
I've also re-enabled an unrelated test which was missing the @Test annotation.
This pull request has now been integrated. Changeset: b03880e3 Author: Maurizio Cimadamore <mcimadamore@openjdk.org> URL: https://git.openjdk.java.net/jdk16/commit/b03880e3 Stats: 30 lines in 2 files changed: 28 ins; 0 del; 2 mod 8259634: MemorySegment::asByteBuffer does not respect spatial bounds Reviewed-by: alanb, chegar ------------- PR: https://git.openjdk.java.net/jdk16/pull/109
participants (3)
-
Alan Bateman
-
Chris Hegarty
-
Maurizio Cimadamore