RFR: 8295707: Create a regression test for JDK-7184401 [v2]

Srinivas Mandalika smandalika at openjdk.org
Wed Nov 23 06:59:33 UTC 2022


On Wed, 23 Nov 2022 02:06:43 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> Srinivas Mandalika has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fixed Review Comments: Removed redundant code
>
> test/jdk/java/awt/EventDispatchThread/InterruptEDTTest.java line 66:
> 
>> 64:                 frame.setVisible(true);
>> 65:             });
>> 66:             ((sun.awt.SunToolkit) (Toolkit.getDefaultToolkit())).realSync();
> 
> You can use the Robot.waitForIdle instead of realSync since jdk9.

There was a comment in the original code before the realSync() call that was removed, which perhaps should have been left as is. 
        // cannot substitute with robot.waitForIdle() presumably because of flushPendingEvents() there
My understanding of above is that for simulating the test scenario - which is - Events (on line 75,76,77) are triggered and while these are potentially not yet complete(as they are wrapped in an invokeLater), the edt is interrupted. 

When run on jdk7u6  - the UI hangs and SOP of line 59 is not invoked. 
When run on jdk7u361 b01 the SOP on line 59 is printed and also the test passed.

waitForIdle here will trigger the flushPendingEvents internally before the edt interrupt call -and that would eliminate any possibility of simulating the above scenario.

> test/jdk/java/awt/EventDispatchThread/InterruptEDTTest.java line 80:
> 
>> 78:             });
>> 79:         } catch (Exception e) {
>> 80:             e.printStackTrace();
> 
> Why do we skip an exception here and in another place below?

As described in the comment above, the intent of the test is to validate the absence of a failure via a test hang and not via an exception.

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

PR: https://git.openjdk.org/jdk/pull/10784



More information about the client-libs-dev mailing list