RFR: 8360070: AccessibleText.getBeforeIndex returns null for last character

Sergey Bylokhov serb at openjdk.org
Mon Jun 23 23:26:29 UTC 2025


On Mon, 23 Jun 2025 17:40:42 GMT, Abhishek Kumar <abhiscxk at openjdk.org> wrote:

>getBeforeIndex method should return null only if the passed index parameter is less than 0 and greater than the text's length.

I am not sure about the statement above. I think the check should take care of the direction, which is -1 in your case. This is actually properly handled by the code below(in t he same method you changed):

                    if (index + direction < model.getLength() &&
                        index + direction >= 0) {
                        return model.getText(index + direction, 1);
                    }

The code you added also affects WORD and SENTENCE cases. I suggest covering those with a test as well.

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

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


More information about the client-libs-dev mailing list