[jdk19] RFR: 8289188: SegmentAllocator:allocateArray(*) default behavior mismatch to spec

Alan Bateman alanb at openjdk.org
Mon Jun 27 14:01:48 UTC 2022


On Mon, 27 Jun 2022 11:01:59 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> This patch fixes an issue where the default method implementation of the SegmentAllocator::allcoateArray methods do not conform to the javadoc. The javadoc says that specific `allocateArray` methods delegate to `allocateArray(MemoryLayout, size)` - but this does not happen; instead these methods just delegate to `allocate(MemoryLayout)`.
> 
> I've addressed this, and added a test - when doing that, I also realized that we had a problem when a `null` array was passed to the array allocation methods (possible with varargs). In such edge case, we should just skip the copy operation (and also remove the spurious `checkNonNull`).

This looks okay too to me, and the null case too.

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

Marked as reviewed by alanb (Reviewer).

PR: https://git.openjdk.org/jdk19/pull/74


More information about the core-libs-dev mailing list