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

Prasanta Sadhukhan psadhukhan at openjdk.org
Wed Sep 3 05:17:47 UTC 2025


On Mon, 25 Aug 2025 12:04:45 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:
> 
>   8339791: review feedback incorporated.

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

> 66:             doTest();
> 67:         } catch (Exception e) {
> 68:             throw new RuntimeException("Unexpected Exception encountered.");

no need to catch Exception only to rethrow

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

> 153:         try {
> 154:             robot = new Robot();
> 155:         } catch (Exception e) {

no need to catch Exception as main already has it in signature

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

> 162:                 passed = false;
> 163:             }
> 164:         } catch (InterruptedException e) {

no need to catch this exception

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

> 177:                 windowActivatedLatch.await(1500, TimeUnit.MILLISECONDS);
> 178:             } catch (Exception e) {
> 179:                 throw new RuntimeException("Unexpected Exception: "

same

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

> 196:                 windowDeactivatedLatch.await(1500, TimeUnit.MILLISECONDS);
> 197:             } catch (Exception e) {
> 198:                 throw new RuntimeException("Unexpected Exception: "

same

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26471#discussion_r2317715078
PR Review Comment: https://git.openjdk.org/jdk/pull/26471#discussion_r2317718685
PR Review Comment: https://git.openjdk.org/jdk/pull/26471#discussion_r2317722816
PR Review Comment: https://git.openjdk.org/jdk/pull/26471#discussion_r2317779936
PR Review Comment: https://git.openjdk.org/jdk/pull/26471#discussion_r2317780065


More information about the client-libs-dev mailing list