RFR: 8339791: Refactor MiscUndecorated/ActiveAWTWindowTest.java [v3]

lawrence.andrews duke at openjdk.org
Thu Sep 4 16:33:46 UTC 2025


On Thu, 4 Sep 2025 08:32:23 GMT, Srinivas Mandalika <smandalika at openjdk.org> wrote:

>> The java/awt/Frame/MiscUndecorated/ActiveAWTWindowTest.java test uses object monitors and wait/notify to synchronise actions in the test.
>> 
>> Using CountDownLatch could make the test simpler, shorter, clearer.
>> Tested the code on a windows-x64, macos-x64 and lnux-x64 machines and the test is working as expected.
>
> Srinivas Mandalika has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Review Feedback: Removed redundant RTEs

test/jdk/java/awt/Frame/MiscUndecorated/ActiveAWTWindowTest.java line 116:

> 114:         button = new Button("Click me");
> 115:         button.addActionListener(new ActionListener() {
> 116:             @Override

Can this be converted to lambda

test/jdk/java/awt/Frame/MiscUndecorated/ActiveAWTWindowTest.java line 136:

> 134:         textField2 = new TextField("TextField");
> 135:         button2.addActionListener(new ActionListener() {
> 136:             @Override

Can this be converted to lambda

test/jdk/java/awt/Frame/MiscUndecorated/ActiveAWTWindowTest.java line 151:

> 149:         robot.setAutoDelay(150);
> 150:         robot.setAutoWaitForIdle(true);
> 151:         if (!windowFocusGainedLatch.await(1500, TimeUnit.MILLISECONDS)) {

Once there is a timeout, we know the frame did not gain focus. Can we throw exception and stop execution ?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26471#discussion_r2322738367
PR Review Comment: https://git.openjdk.org/jdk/pull/26471#discussion_r2322739626
PR Review Comment: https://git.openjdk.org/jdk/pull/26471#discussion_r2322745226


More information about the client-libs-dev mailing list