8338731: MemoryLayout::offsetHandle can return a negative offset

Reviewed-by: pminborg, psandoz
This commit is contained in:
Maurizio Cimadamore 2024-08-28 10:22:34 +00:00
parent 2e174c6367
commit 1ff9ac7233
3 changed files with 22 additions and 9 deletions

View file

@ -574,7 +574,9 @@ public sealed interface MemoryLayout
* <p>
* For any given dynamic argument {@code x_i}, it must be that {@code 0 <= x_i < size_i},
* where {@code size_i} is the size of the open path element associated with {@code x_i}.
* Otherwise, the returned method handle throws {@link IndexOutOfBoundsException}.
* Otherwise, the returned method handle throws {@link IndexOutOfBoundsException}. Moreover,
* the value of {@code b} must be such that the computation for {@code offset} does not overflow,
* or the returned method handle throws {@link ArithmeticException}.
*
* @apiNote The returned method handle can be used to compute a layout offset,
* similarly to {@link #byteOffset(PathElement...)}, but more flexibly, as