RFR: 8356145: ListEnterExitTest.java fails on macos [v3]

Alexey Ivanov aivanov at openjdk.org
Tue May 20 19:37:56 UTC 2025


On Tue, 20 May 2025 07:53:30 GMT, Abhishek Kumar <abhiscxk at openjdk.org> wrote:

>> Test was failing on macOS 14.7.1 system in CI pipeline. Logged output suggests that the mouse exit event is not triggered and thus the test fails.
>> Increased number of list items and adjusted the X and Y offset for mouse move events, so the mouse pointer will be within the frame and added robot delay to stabilize the test.
>> 
>> Verified the updated test in CI on macOS 14.7 machine and there is no failure.
>
> Abhishek Kumar has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains three commits:
> 
>  - File merge
>  - Review comment fix, latch and other changes
>  - Test Stabilization

Changes requested by aivanov (Reviewer).

test/jdk/java/awt/List/ListEnterExitTest.java line 54:

> 52:     private final int LATCH_TIMEOUT = 3;
> 53:     private static volatile CountDownLatch mouseEnterLatch = new CountDownLatch(1);
> 54:     private static volatile CountDownLatch mouseExitLatch = new CountDownLatch(1);

Suggestion:


    private static final int X_OFFSET = 30;
    private static final int Y_OFFSET = 40;
    private static final int LATCH_TIMEOUT = 3;

    private final CountDownLatch mouseEnterLatch = new CountDownLatch(1);
    private final CountDownLatch mouseExitLatch = new CountDownLatch(1);

test/jdk/java/awt/List/ListEnterExitTest.java line 97:

> 95: 
> 96:             if (!mouseEnterLatch.await(LATCH_TIMEOUT, TimeUnit.SECONDS)) {
> 97:                 System.out.println("mouseEnterLatch count is : " + mouseEnterLatch.getCount());

This print is redundant: if `mouseEnterLatch` isn't released yet, its count is 1 — it can't have any other value. At the same, the count could change right after the timeout occurred which would lead to a very confusing output.

Thus, I recommend removing printing the count of a latch.

test/jdk/java/awt/List/ListEnterExitTest.java line 114:

> 112:     }
> 113: 
> 114:     static class MouseEnterExitListener extends MouseAdapter {

Suggestion:

    private class MouseEnterExitListener extends MouseAdapter {

Removing `static` allows removing `static` modifier from the latches.

In fact, the `MouseEnterExitListener` class can be eliminated altogether… Yet the code could be clearer this way.

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

PR Review: https://git.openjdk.org/jdk/pull/25299#pullrequestreview-2855348060
PR Review Comment: https://git.openjdk.org/jdk/pull/25299#discussion_r2098709525
PR Review Comment: https://git.openjdk.org/jdk/pull/25299#discussion_r2098723381
PR Review Comment: https://git.openjdk.org/jdk/pull/25299#discussion_r2098717008


More information about the client-libs-dev mailing list