RFR: 8339791: Refactor MiscUndecorated/ActiveAWTWindowTest.java
Abhishek Kumar
abhiscxk at openjdk.org
Fri Aug 1 07:21:55 UTC 2025
On Fri, 25 Jul 2025 05:33:31 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.
Few more observations :
1. Add a space wherever application. At L76... `try {`
2. Don't think it is required to print stack trace, you can throw it in RTE.
3. At L165, robot.waitForIdle(5 * delay);
4. Access UI components on EDT. e.g L166 etc.
5. Can remove `//captureScreenAndSave();` and `System.err.println("Test failed!");` lines
test/jdk/java/awt/Frame/MiscUndecorated/ActiveAWTWindowTest.java line 61:
> 59: private static final CountDownLatch windowFocusGainedLatch = new CountDownLatch(1);
> 60: private boolean passed = true;
> 61: private final int delay = 150;
Suggestion:
private final int DELAY = 150;
test/jdk/java/awt/Frame/MiscUndecorated/ActiveAWTWindowTest.java line 98:
> 96: frame.setUndecorated(true);
> 97: frame.addWindowFocusListener(new WindowFocusListener() {
> 98: public void windowGainedFocus(WindowEvent event) {
add @override for all overridden methods.
-------------
PR Review: https://git.openjdk.org/jdk/pull/26471#pullrequestreview-3077988039
PR Review Comment: https://git.openjdk.org/jdk/pull/26471#discussion_r2247148963
PR Review Comment: https://git.openjdk.org/jdk/pull/26471#discussion_r2247149511
More information about the client-libs-dev
mailing list