On Thu, 29 May 2025 06:33:37 GMT, Abhishek Kumar <abhis...@openjdk.org> wrote:

>> src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java line 
>> 877:
>> 
>>> 875:         if (ac != null) {
>>> 876:             Accessible aComp = null;
>>> 877:             for (int i = 0; i < ac.getAccessibleChildrenCount(); i++) {
>> 
>> I suggest replacing for with while. If the desired submenu is at the 
>> beginning of the list, there’s no need to traverse it further.
>
> I think even though the submenu is at the beginning but if it is not visible 
> then we need to traverse further to check for other submenu if present.

Optimized the code to not traverse further if the desired submenu is fetched. 
Verified the recent change with the test code.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25470#discussion_r2113344471

Reply via email to