On Sat, 3 Dec 2022 18:40:59 GMT, Sergey Tsypanov <[email protected]> wrote:
>> test/jdk/java/lang/Character/Supplementary.java line 808:
>>
>>> 806: return;
>>> 807: }
>>> 808: if (expectedException.isInstance(e)) { //
>>> Character.codePointBefore() throws
>>
>> The test should fail without the fix, but this fall-through allows the test
>> to pass.
>>
>> The qualification added for `isAt` is hiding a second/corresponding bug in
>> `codePointBefore` where the index is not checked and an
>> ArrayIndexOutOfBounds occurs at codePointBeforeImpl: 9488.
>
> Yeah, this AIOOBE is exactly the reason why I added this. So should we modify
> `codePointBefore` in the same way as `codePointAt`?
I'm asking because counter-intuitively `codePointBefore ` doesn't specify IOOBE
for negative `index`.
/**
* @return the Unicode code point value before the given index.
* @throws NullPointerException if {@code a} is null.
* @throws IndexOutOfBoundsException if the {@code index}
* argument is not greater than the {@code start} argument or
* is greater than the length of the {@code char} array, or
* if the {@code start} argument is negative or not less than
* the length of the {@code char} array.
* @since 1.5
*/
```
-------------
PR: https://git.openjdk.org/jdk/pull/11480