Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8259743 | 17 | Maurizio Cimadamore | P3 | Resolved | Fixed | b06 |
JDK-8260131 | 16.0.1 | Maurizio Cimadamore | P3 | Resolved | Fixed | b03 |
The following test fails:
@Test
public void readOnlyByteBufferFromSharedNativeSegment() {
try (MemorySegment segment = MemorySegment.allocateNative(8).share()) {
var byteBuffer = segment.asByteBuffer();
// This fails for native segments, but passes for heap segments.
// Throws UOE: ByteBuffer derived from shared segments not supported
byteBuffer.asReadOnlyBuffer();
}
}
The problem is that some of the slice constructor are using the internal DirectBuffer::address method, which is where the check for shared buffer takes place.
@Test
public void readOnlyByteBufferFromSharedNativeSegment() {
try (MemorySegment segment = MemorySegment.allocateNative(8).share()) {
var byteBuffer = segment.asByteBuffer();
// This fails for native segments, but passes for heap segments.
// Throws UOE: ByteBuffer derived from shared segments not supported
byteBuffer.asReadOnlyBuffer();
}
}
The problem is that some of the slice constructor are using the internal DirectBuffer::address method, which is where the check for shared buffer takes place.
- backported by
-
JDK-8259743 Check for buffer backed by shared segment kicks in in unexpected places
-
- Resolved
-
-
JDK-8260131 Check for buffer backed by shared segment kicks in in unexpected places
-
- Resolved
-