RFR: 8338282: javax/swing/JMenuBar/TestMenuMnemonicLinuxAndMac.java test failed on macOS and Ubuntu

Abhishek Kumar abhiscxk at openjdk.org
Wed Jul 16 06:14:46 UTC 2025


On Wed, 16 Jul 2025 05:25:39 GMT, Tejesh R <tr at openjdk.org> wrote:

>> Test is failing on intermittently on macOS and ubuntu machine in CI testing.
>> Test stabilization done by requesting focus for the frame before starting the testing. 
>> 
>> Ran the test before and after the fix and there is no failure after test stabilization for multiple run.
>> CI link is added in JBS.
>
> test/jdk/javax/swing/JMenuBar/TestMenuMnemonicLinuxAndMac.java line 120:
> 
>> 118:         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
>> 119:         frame.setVisible(true);
>> 120:         frame.toFront();
> 
> ` frame.toFront();` is required ? Did you try only with `frame.requestFocus();` ?

`frame.requestFocus()` tries to make the frame current focus owner but it does not guarantee that focus will be granted. So, to be on safer side, it's better to bring the frame to the front.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26307#discussion_r2209352035


More information about the client-libs-dev mailing list