RFR: 8341982: Simplify JButton/bug4323121.java [v3]

Abhishek Kumar abhiscxk at openjdk.org
Fri Oct 18 12:12:40 UTC 2024


On Fri, 18 Oct 2024 11:44:19 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> The test `javax/swing/JButton/bug4323121.java` contains lots of unused methods.
>> 
>> I removed all the unused methods by extending `MouseAdapter`.
>> 
>> I use `CountDownLatch` to synchronise actions in the test.
>> 
>> The test still verifies `button.getModel().isArmed()` doesn't always return `true` for classes which extend `JButton`. I verified the updated test fails in 1.3.0 and passes in 1.4.0, so the test still reproduces the original problem.
>
> Alexey Ivanov has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Amend indentation in the finally block
>  - Inline mouseEntered listener for the button

test/jdk/javax/swing/JButton/bug4323121.java line 59:

> 57: 
> 58:     // Usage of this flag is thread-safe because of using the mouseEntered latch
> 59:     private static boolean modelArmed;

should it be volatile?

test/jdk/javax/swing/JButton/bug4323121.java line 105:

> 103:             });
> 104: 
> 105:             robot.mouseMove(buttonCenter.x , buttonCenter.y);

Suggestion:

            robot.mouseMove(buttonCenter.x, buttonCenter.y);

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21475#discussion_r1806382633
PR Review Comment: https://git.openjdk.org/jdk/pull/21475#discussion_r1806385015


More information about the client-libs-dev mailing list