On Fri, 4 Jul 2025 15:03:33 GMT, Volkan Yazici <vyaz...@openjdk.org> wrote:

>> Maybe use `jdk.internal.util.Preconditions` directly instead?
>> Suggestion:
>> 
>>         Preconditions.checkFromIndexSize(off, len, ba.length, null);
>
> @ExE-Boss, I consulted this internally and decided to stick to using public 
> APIs, unless there is a reason not to do so. In short, given 
> `Objects::checkFromIndexSize` directly delegates to 
> `Preconditions::checkFromIndexSize`, I expect that C2 will do its magic. Note 
> my remark above that, prior to promoting this draft to a PR, a comprehensive 
> benchmark suite run will be performed when all intrinsics of concern are 
> addressed.

Doh! I've just noticed `Objects::checkFromIndexSize` throws 
`IndexOutOfBoundsException`, though we need `ArrayIndexOutOfBoundsException`. 
`Objects::checkFromIndexSize` doesn't accept an exception supplier, replacing 
it with `Preconditions::checkFromIndexSize`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25998#discussion_r2185930404

Reply via email to