RFR: 8259911: byteArrayViewVarHandle should throw ArrayIndexOutOfBoundsException
Claes Redestad
redestad at openjdk.java.net
Tue Jan 19 21:02:50 UTC 2021
On Tue, 19 Jan 2021 20:30:46 GMT, Claes Redestad <redestad at openjdk.org> wrote:
>> The change to AIOOBE is reasonable. Have you considered making this just as an implementation change and leave the spec as is?
>
>> The change to AIOOBE is reasonable. Have you considered making this just as an implementation change and leave the spec as is?
>
> What would be the benefits? AFAICT the CSR is still needed since it's a small behavioral change, and updating the spec helps communicate that change.
I agree the change is allowable within the current spec. The behavior change is observable, though, and however unlikely there might be code that relies on exact class of the exception being thrown.
So while perhaps not strictly needed, the spec change makes sense coming from the other way: If I have some array-based code then that will be throwing AIOOBE on OOBs. But the `byteArrayViewVarHandle` code is specified to throw IOOBE, so a developer picking it up would have to catch and rewrap exceptions or accept the compatibility risk. Harmonizing to specify AIOOBE improves the migration story. Case in point is #1855 which require changes to some tests that are expecting AIOOBE.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2124
More information about the hotspot-compiler-dev
mailing list