RFR: 8373967: [macos] User interactions with List do not trigger ItemEvent after programmatic change

Sergey Bylokhov serb at openjdk.org
Fri Dec 19 20:24:10 UTC 2025


The fix in LWListPeer introduced by [JDK-7125456](https://bugs.openjdk.org/browse/JDK-7125456) was intended to suppress ItemEvents for programmatic changes to a List, while still allowing events generated by user interaction.

The implementation unconditionally bypasses the listener logic:
https://hg.openjdk.org/jdk7u/jdk7u-osx/jdk/rev/dfa991721457
Unfortunately that logic also updates the cached selection state. As a result, when the application select something programmatically, the cached state is not updated.

The change move out the `oldSelectedIndices = source.getSelectedIndices();` from the `!isSkipStateChangedEvent()` condition, plus some cleanup.

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

Commit messages:
 - 8373967: [macos] User interactions with List do not trigger ItemEvent after programmatic change

Changes: https://git.openjdk.org/jdk/pull/28890/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28890&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8373967
  Stats: 135 lines in 2 files changed: 121 ins; 5 del; 9 mod
  Patch: https://git.openjdk.org/jdk/pull/28890.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28890/head:pull/28890

PR: https://git.openjdk.org/jdk/pull/28890


More information about the client-libs-dev mailing list