On Thu, 23 Jan 2025 09:33:33 GMT, Alexander Zvegintsev <azveg...@openjdk.org> wrote:
>> Alexey Ivanov has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Use setLength to reset actualSelectionOrder >> >> Co-authored-by: Aleksandr Zvegintsev >> <77687766+azveg...@users.noreply.github.com> > > test/jdk/java/awt/List/ItemEventTest/ItemEventTest.java line 93: > >> 91: || e.id == Event.LIST_SELECT)) { >> 92: logEvent("handleEvent: ", e.arg); >> 93: } > > Suggestion: > > if (e.target instanceof List) { > switch (e.id) { > case Event.LIST_SELECT > -> logEvent("handleEvent: LIST_SELECT ", e.arg); > case Event.LIST_DESELECT > -> logEvent("handleEvent: LIST_DESELECT ", e.arg); > } > } > > Not sure if this is really useful or not, but logging can be slightly > improved. It makes the code more complicates but it adds no value… I've been trying to understand what's going on in [JDK-8345077](https://bugs.openjdk.org/browse/JDK-8345077) and why the test fails. The original test didn't give any clues. I added screenshots and event logging: the screenshots show the elements in the list get selected and deselected, yet no events are received via `handleEvent` — it's enough to diagnose the problem. That is the test fails, when it fails, because `handleEvent` is never called while items in the list are selected and deselected. The test always passes with `ItemListener`. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23238#discussion_r1926800649