-
Bug
-
Resolution: Fixed
-
P3
-
22
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8321706 | 23 | Per-Ake Minborg | P3 | Resolved | Fixed | b02 |
As per the spec-
https://download.java.net/java/early_access/jdk22/docs/api/java.base/java/lang/foreign/SegmentAllocator.html#allocateFrom(java.lang.foreign.AddressLayout,java.lang.foreign.MemorySegment)
when the supplied MemorySegment is not 'native' then this method supposed to throw "UnsupportedOperationException" but actually it throws java.lang.IllegalArgumentException: Heap segment not allowed:
Sample code
====
private void test01() {
SegmentAllocator segmentAllocator = SegmentAllocator.prefixAllocator(Arena.ofAuto().allocate(1024));
MemorySegment memorySegment = MemorySegment.ofArray(new int[10]);
System.out.println("memorySegment is Native " + memorySegment.isNative());
try {
segmentAllocator.allocateFrom(ValueLayout.ADDRESS.withName("test"), memorySegment);
} catch (Exception ex) {
System.out.println("The ex is " + ex);
}
}
=====
https://download.java.net/java/early_access/jdk22/docs/api/java.base/java/lang/foreign/SegmentAllocator.html#allocateFrom(java.lang.foreign.AddressLayout,java.lang.foreign.MemorySegment)
when the supplied MemorySegment is not 'native' then this method supposed to throw "UnsupportedOperationException" but actually it throws java.lang.IllegalArgumentException: Heap segment not allowed:
Sample code
====
private void test01() {
SegmentAllocator segmentAllocator = SegmentAllocator.prefixAllocator(Arena.ofAuto().allocate(1024));
MemorySegment memorySegment = MemorySegment.ofArray(new int[10]);
System.out.println("memorySegment is Native " + memorySegment.isNative());
try {
segmentAllocator.allocateFrom(ValueLayout.ADDRESS.withName("test"), memorySegment);
} catch (Exception ex) {
System.out.println("The ex is " + ex);
}
}
=====
- backported by
-
JDK-8321706 SegmentAllocator:allocateFrom(AddressLayout, MemorySegment) does not throw stated UnsupportedOperationException
-
- Resolved
-
- csr for
-
JDK-8321513 SegmentAllocator:allocateFrom(AddressLayout, MemorySegment) does not throw stated UnsupportedOperationException
-
- Closed
-
- links to
-
Commit openjdk/jdk22/e88a0220
-
Commit openjdk/jdk/d13302f8
-
Review openjdk/jdk22/7
-
Review openjdk/jdk/16993
(1 links to)