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

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Jun 27 13:12:32 UTC 2022


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`).

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

Commit messages:
 - Remove whitespaces
 - Readd erroneously removed code
 - Merge branch 'master' into allocateArray_delegate
 - Initial push

Changes: https://git.openjdk.org/jdk19/pull/74/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk19&pr=74&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8289188
  Stats: 49 lines in 3 files changed: 43 ins; 1 del; 5 mod
  Patch: https://git.openjdk.org/jdk19/pull/74.diff
  Fetch: git fetch https://git.openjdk.org/jdk19 pull/74/head:pull/74

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


More information about the core-libs-dev mailing list