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

Harshitha Onkar honkar at openjdk.org
Thu Jan 9 20:11:36 UTC 2025


On Thu, 9 Jan 2025 19:51:09 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> test/jdk/javax/swing/JRadioButton/ButtonGroupFocus/ButtonGroupFocusTest.java line 70:
>> 
>>> 68:     private static final CountDownLatch button4FocusLatch = new CountDownLatch(1);
>>> 69: 
>>> 70:     private static final CountDownLatch button2FocusLatch2 = new CountDownLatch(2);
>> 
>> Minor: Should the no. of  button2FocusLatch2 latches be 1? since we already have another button2FocusLatch 
>> 
>> Suggestion:
>> 
>>     private static final CountDownLatch button2FocusLatch2 = new CountDownLatch(1);
>
> 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?

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

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


More information about the client-libs-dev mailing list