RFR: 8259911: byteArrayViewVarHandle should throw ArrayIndexOutOfBoundsException

Jorn Vernee jvernee at openjdk.java.net
Wed Jan 20 12:25:47 UTC 2021

On Mon, 18 Jan 2021 12:09:23 GMT, Claes Redestad <redestad at openjdk.org> wrote:

> Change `MethodHandles.byteArrayViewVarHandle` to throw `ArrayIndexOutOfBoundsException` rather than the more generic `IndexArrayOutOfBoundsException`. This feels more natural, and reduces the risk for subtle behavioral mismatch when migrating code from arrays/Unsafe to VHs. 
> CSR: [JDK-8259912](https://bugs.openjdk.java.net/browse/JDK-8259912)

Marked as reviewed by jvernee (Committer).

src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 4374:

> 4372:      * <p>
> 4373:      * Access of bytes at a given index will result in an
> 4374:      * {@code ArrayIndexOutOfBoundsException} if the index is less than {@code 0}

Should the copyright year of this file also be updated?


PR: https://git.openjdk.java.net/jdk/pull/2124

More information about the core-libs-dev mailing list