RFR: 8360070: AccessibleText.getBeforeIndex returns null for last character [v4]

Abhishek Kumar abhiscxk at openjdk.org
Thu Aug 7 12:13:20 UTC 2025


On Thu, 7 Aug 2025 11:55:34 GMT, Abhishek Kumar <abhiscxk at openjdk.org> wrote:

>> `AccessibleText.getBeforeIndex` method returns `null for last characte`r due to the **wrong boundary value condition check**.
>> This method returns `null` when the `passed index parameter` is equal to `text's length` which is incorrect.
>> `getBeforeIndex` method should return `null` only if the **passed index parameter is less than 0 and greater than the text's length**.
>> 
>> After modifying the condition check, expected character is returned. Test is added to verify the check,
>
> Abhishek Kumar has updated the pull request incrementally with one additional commit since the last revision:
> 
>   index spec update

There are similar APIs `getTextSequenceAt, getTextSequenceBefore and getTextSequenceAfter` for `AccessibleExtendedText` interface that invokes `getSequenceAtIndex` to return the `AccessibleTextSequence` and I think the fix is required for those method as well.
I also suspect `getTextBounds` method too that it may not return correct bound for `index = length of text` in case of CHARACTER and WORD. I will test and update in next commit.

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

PR Comment: https://git.openjdk.org/jdk/pull/25941#issuecomment-3163928134


More information about the client-libs-dev mailing list