RFR: 8354219 : Automate javax/swing/JComboBox/ComboPopupBug.java [v7]

Alexey Ivanov aivanov at openjdk.org
Fri Apr 25 18:38:39 UTC 2025


On Thu, 24 Apr 2025 15:53:32 GMT, Anass Baya <abaya at openjdk.org> wrote:

>> test/jdk/javax/swing/JComboBox/ComboPopupBug.java line 63:
>> 
>>> 61:             if (frame != null) {
>>> 62:                 SwingUtilities.invokeAndWait(() -> frame.dispose());
>>> 63:             }
>> 
>> The null-check should be on EDT too, all the tests follow this pattern.
>> Suggestion:
>> 
>>             SwingUtilities.invokeAndWait(() -> {
>>                 if (frame != null) {
>>                     frame.dispose();
>>                 }
>>             });
>
> Thank you. I had doubt about it but i saw in a recent updated Test Test6827032.java that it is not done on the EDT thread.

It shouldn't be a problem… `invokeAndWait` that creates the frame serves as a synchronisation barrier, and all the changes to fields done on EDT should be visible to the main thread after `invokeAndWait` returns.

However, for the sake of consistency, it's easier to put the null-check into the body of `invokeAndWait` when disposing of the frame.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24624#discussion_r2058813281


More information about the client-libs-dev mailing list