On Tue, 10 Dec 2024 08:18:36 GMT, Quan Anh Mai <[email protected]> wrote:
>> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte512Vector.java
>> line 1046:
>>
>>> 1044: String msg = ("index "+si+"out of range
>>> ["+length+"] in "+
>>> 1045: java.util.Arrays.toString(indices));
>>> 1046: throw new AssertionError(msg);
>>
>> Why not directly throw IndexOutOfBoundsException here?
>
> This is called in an `assert` so I think throwing `AssertionError` seems more
> reasonable, the original implementation also throws `AssertionError`
I see, you want to throw an error here and not just use an assert statement
that reports an assertion failure with -ea flag. This is a newly added
routine, why don't you simply return a false and let the assertion invoking
this routine do the rest?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21042#discussion_r1877642371