On Tue, 21 Apr 2026 21:01:19 GMT, Alexander Zuev <[email protected]> wrote:
>> Jeremy Wood has updated the pull request incrementally with seven additional
>> commits since the last revision:
>>
>> - 8381236: fixing whitespace
>> - 8381236: remove AXChangeNotifier after dispose
>>
>> This PR really focuses on controlling the lifecycle of a CAccessible, so
>> if we're encouraging them to be disposed more often: we should also
>> uninstall our listeners.
>> - 8381236: tweak comment
>> - 8381236: make new method private
>> - 8381236: remove unused import
>> - 8381236: move static field above non-static fields
>> - 8381236: refactor to use "ancestor" listener
>>
>> Using "ancestor" listener makes a little more sense: each individual
>> component can dispose of its own CAccessible. (Instead of relying on a
>> parent to dispose its descendants recursively.)
>>
>> Also I poked around with debugger breakpoints and realized CAccessibles
>> are not automatically getting recreated as quickly as I'd like so:
>> A. I recreate them myself when the Component is reattached to a hierarchy
>> B. I cleared the cache (setNativeAXResource(null)) to make sure the new
>> CAccessible gets used
>
> src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessible.java line 102:
>
>> 100: @Override
>> 101: public void propertyChange(PropertyChangeEvent evt) {
>> 102: Component comp = (Component) evt.getSource();
>
> Couldn't you just replace these 6 lines with simple
> `if (evt.getSource() instanceof Accessible ax) {`
> that will make code much cleaner.
OK, this is updated
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/30578#discussion_r3120875825