RFR: 8361379: [macos] Refactor accessibility code to retrieve attribute by name

Andy Goryachev angorya at openjdk.org
Tue Jul 8 21:40:44 UTC 2025


On Thu, 3 Jul 2025 22:17:01 GMT, Alexander Zuev <kizune at openjdk.org> wrote:

> - Copyright year update;
> - Introduce new function requestNodeAttribute and refactor code to use it;
> - Fix some typos;
> - Enable new code to handle TabPages since TabGroup was implemented;

Like this very much, a good cleanup.

modules/javafx.graphics/src/main/native-glass/mac/a11y/AccessibleBase.m line 99:

> 97: }
> 98: 
> 99: - (jobject)getJAccessible {

should this K&R brace be reverted to the _objectively better_ style used elsewhere in this file?

modules/javafx.graphics/src/main/native-glass/mac/a11y/AccessibleBase.m line 113:

> 111:     GET_MAIN_JENV;
> 112:     if (env == NULL) return NULL;
> 113:     jresult = (jobject)(*env)->CallLongMethod(env, [self getJAccessible],

not an expert, but do we really need to initialize `jresult` to NULL in line 110?
can the variable be declared in line 113 ?

modules/javafx.graphics/src/main/native-glass/mac/a11y/AccessibleBase.m line 191:

> 189:     id p = [self requestNodeAttribute:@"AXPosition"];
> 190:     id s = [self requestNodeAttribute:@"AXSize"];
> 191:     if (p == NULL || s == NULL) {

not a big issue, but would it be (marginally) better to bail out early if p == NULL ?

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

PR Review: https://git.openjdk.org/jfx/pull/1840#pullrequestreview-2999152480
PR Review Comment: https://git.openjdk.org/jfx/pull/1840#discussion_r2193476993
PR Review Comment: https://git.openjdk.org/jfx/pull/1840#discussion_r2193479120
PR Review Comment: https://git.openjdk.org/jfx/pull/1840#discussion_r2193484839


More information about the openjfx-dev mailing list