RFR: 8346581: JRadioButton/ButtonGroupFocusTest.java fails in CI on Linux [v2]

Alexey Ivanov aivanov at openjdk.org
Thu Jan 9 20:19:40 UTC 2025


On Thu, 9 Jan 2025 20:08:21 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:

>> No, `button2FocusLatch` tracks that _Button 2_ gets the initial focus; `button2FocusLatch2` tracks that _Button 2_ gets focus for the second time in case of repeated `KEY_PRESS` event for the <kbd>Tab</kbd> key.
>> 
>> If `button2FocusLatch2` is released, the test fails with a clear error message — _Button 2_ received focus whereas _Button 4_ is expected to have it. If the test continues, it will still fail because _Button 3_ won't get focus but there will be no indication why.
>
> I understand that you need 2 separate CountDownLatches for Button 2, but my question was about the count of  `button2FocusLatch2` . Shouldn't this be 1 instead of 2 counts or do you mean we require 2 counts of `button2FocusLatch2` to track focus twice after the initial one?

No, it has to be 2. Focus listeners are added before the frame is displayed.

https://github.com/openjdk/jdk/blob/e7991216fb25a0eeb094cbeef74128c6770c051a/test/jdk/javax/swing/JRadioButton/ButtonGroupFocus/ButtonGroupFocusTest.java#L100-L104

If Button 2 receives focus **twice**, `button2FocusLatch2` will be released. If it had 1, then the latch would be released when Button 2 gets focus at the test start.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22977#discussion_r1909382782


More information about the client-libs-dev mailing list