On Tue, 15 Oct 2024 02:45:42 GMT, Alisen Chung <[email protected]> wrote:
>> test/jdk/java/awt/Dialog/DialogDisposeLeak.java line 42:
>>
>>> 40:
>>> 41: public static void main(String args[]) throws Exception {
>>> 42: EventQueue.invokeLater(() -> {
>>
>> Suggestion:
>>
>> EventQueue.invokeAndWait(() -> {
>>
>>
>> The test may prematurely end with `invokeLater` even before it starts
>> testing anything, because jtreg will kill it after exiting the main.
>
> the problem with using invokeAndWait is that the test uses a modal dialog and
> so everything is blocked once the dialog is shown in an invokeAndWait
Try to run it with jtreg and `invokeLater`, you will not see the
appearing/disappearing dialog, so it doesn't have time to check anything.
This is almost the same as running a jtreg test with the empty main method, so
the test appears to be useless as it is now.
> the problem with using invokeAndWait is that the test uses a modal dialog and
> so everything is blocked once the dialog is shown in an invokeAndWait
It seems that you need to rewrite the test properly, using the robot off the
EDT to interact with a mouse (as it was in the original test, because it is
critical according to
[JDK-4193022](https://bugs.openjdk.org/browse/JDK-4193022)), and all the stuff
we usually use for the test stability(`robot.waitForIdle(); robot.delay(500)`
etc.)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21488#discussion_r1800585019