Re: RFR: 8341982: Simplify JButton/bug4323121.java [v8]

2024-12-02 Thread Alexey Ivanov
On Fri, 18 Oct 2024 22:36:33 GMT, Sergey Bylokhov wrote: >> This test follows the same pattern that I used in >> https://github.com/openjdk/jdk/pull/21474: >> >> https://github.com/openjdk/jdk/pull/21474/files#diff-2a8cee50408407d7e24de4cb85f0921cfc5db7c215d3b29cf101a4050323e9a9R92 > >> To ensu

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v8]

2024-11-06 Thread Alexey Ivanov
> 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 >

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v7]

2024-11-04 Thread Alexey Ivanov
On Fri, 18 Oct 2024 22:36:33 GMT, Sergey Bylokhov wrote: >> This test follows the same pattern that I used in >> https://github.com/openjdk/jdk/pull/21474: >> >> https://github.com/openjdk/jdk/pull/21474/files#diff-2a8cee50408407d7e24de4cb85f0921cfc5db7c215d3b29cf101a4050323e9a9R92 > >> To ensu

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v7]

2024-10-21 Thread Abhishek Kumar
On Mon, 21 Oct 2024 18:52:14 GMT, Alexey Ivanov 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 stil

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v7]

2024-10-21 Thread Alexey Ivanov
> 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 >

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v5]

2024-10-21 Thread Alexey Ivanov
On Mon, 21 Oct 2024 15:54:32 GMT, Abhishek Kumar wrote: >> Alexey Ivanov has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Use JButton directly instead of TestButton subclass > > test/jdk/javax/swing/JButton/bug4323121.java line 50: > >>

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v6]

2024-10-21 Thread Alexey Ivanov
> 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 >

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v6]

2024-10-21 Thread Alexey Ivanov
On Mon, 21 Oct 2024 18:39:07 GMT, Alexey Ivanov wrote: >>> To ensure all the events in the queue are handled, I added >>> `robot.waitForIdle()`. >> >> This will flush events which were posted after the windows gained focus, but >> before the patch the test flushed all events (including event t

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v5]

2024-10-21 Thread Alexey Ivanov
On Fri, 18 Oct 2024 22:36:33 GMT, Sergey Bylokhov wrote: >> This test follows the same pattern that I used in >> https://github.com/openjdk/jdk/pull/21474: >> >> https://github.com/openjdk/jdk/pull/21474/files#diff-2a8cee50408407d7e24de4cb85f0921cfc5db7c215d3b29cf101a4050323e9a9R92 > >> To ensu

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v5]

2024-10-21 Thread Abhishek Kumar
On Mon, 21 Oct 2024 15:12:50 GMT, Alexey Ivanov 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 stil

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v5]

2024-10-21 Thread Alexey Ivanov
> 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 >

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v4]

2024-10-21 Thread Alexey Ivanov
On Fri, 18 Oct 2024 19:16:54 GMT, Harshitha Onkar wrote: >> Alexey Ivanov has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Remove space before comma >> >> Co-authored-by: Abhishek Kumar > > test/jdk/javax/swing/JButton/bug4323121.ja

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v4]

2024-10-21 Thread Alexey Ivanov
On Fri, 18 Oct 2024 19:16:14 GMT, Harshitha Onkar wrote: >> Alexey Ivanov has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Remove space before comma >> >> Co-authored-by: Abhishek Kumar > > test/jdk/javax/swing/JButton/bug4323121.ja

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v4]

2024-10-18 Thread Sergey Bylokhov
On Fri, 18 Oct 2024 17:41:51 GMT, Alexey Ivanov wrote: >> I reversed the order because window may gain focus before all the events are >> processed. >> >> To ensure all the events in the queue are handled, I added >> `robot.waitForIdle()`. >> >> The next action in the test is to get location

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v4]

2024-10-18 Thread Alexey Ivanov
On Fri, 18 Oct 2024 16:48:21 GMT, Alexey Ivanov wrote: >> test/jdk/javax/swing/JButton/bug4323121.java line 66: >> >>> 64: }); >>> 65: robot.waitForIdle(); >>> 66: robot.delay(1000); >> >> The new code probably should follow the same pattern, flush all >> ev

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v4]

2024-10-18 Thread Harshitha Onkar
On Fri, 18 Oct 2024 12:19:24 GMT, Alexey Ivanov 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 stil

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v4]

2024-10-18 Thread Alexey Ivanov
On Fri, 18 Oct 2024 16:36:59 GMT, Sergey Bylokhov wrote: >> Alexey Ivanov has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Remove space before comma >> >> Co-authored-by: Abhishek Kumar > > test/jdk/javax/swing/JButton/bug4323121.ja

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v4]

2024-10-18 Thread Sergey Bylokhov
On Fri, 18 Oct 2024 12:19:24 GMT, Alexey Ivanov 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 stil

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

2024-10-18 Thread Abhishek Kumar
On Fri, 18 Oct 2024 12:12:48 GMT, Alexey Ivanov wrote: >> 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? >

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v4]

2024-10-18 Thread Abhishek Kumar
On Fri, 18 Oct 2024 12:19:24 GMT, Alexey Ivanov 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 stil

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v4]

2024-10-18 Thread Alexey Ivanov
> 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 >

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

2024-10-18 Thread Alexey Ivanov
On Fri, 18 Oct 2024 12:02:49 GMT, Abhishek Kumar wrote: >> 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/

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

2024-10-18 Thread Abhishek Kumar
On Fri, 18 Oct 2024 11:39:40 GMT, Alexey Ivanov wrote: >> Both approaches sounds okay to me, but adding an anonymous class similar to >> WindowAdapter() may be clearer. > > Since you both for inlining the listener, I've amended the code. Looks clearer now. - PR Review Comment: htt

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

2024-10-18 Thread Abhishek Kumar
On Fri, 18 Oct 2024 11:44:19 GMT, Alexey Ivanov 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 stil

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

2024-10-18 Thread Alexey Ivanov
> 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 >

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

2024-10-18 Thread Alexey Ivanov
On Tue, 15 Oct 2024 01:00:02 GMT, Harshitha Onkar wrote: >> If anyone else thinks using an anonymous class here makes the code shorter >> and cleaner, I'll go for it. > > Both approaches sounds okay to me, but adding an anonymous class similar to > WindowAdapter() may be clearer. Since you bot

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v2]

2024-10-15 Thread Alisen Chung
On Mon, 14 Oct 2024 15:34:29 GMT, Alexey Ivanov 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 stil

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v2]

2024-10-15 Thread Damon Nguyen
On Mon, 14 Oct 2024 15:34:29 GMT, Alexey Ivanov 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 stil

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v2]

2024-10-14 Thread Harshitha Onkar
On Mon, 14 Oct 2024 15:34:29 GMT, Alexey Ivanov 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 stil

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v2]

2024-10-14 Thread Harshitha Onkar
On Mon, 14 Oct 2024 15:59:26 GMT, Alexey Ivanov wrote: >> Ok... > > If anyone else thinks using an anonymous class here makes the code shorter > and cleaner, I'll go for it. Both approaches sounds okay to me, but adding an anonymous class similar to WindowAdapter() may be clearer. ---

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v2]

2024-10-14 Thread Alexey Ivanov
On Mon, 14 Oct 2024 15:55:34 GMT, Abhishek Kumar wrote: >> I removed the unneeded listener and inlined creation of the event handler. >> >> Thus, I kept the current structure of test code. I prefer it this way for >> consistency with `JButton/bug4490179.java` in >> https://github.com/openjdk/j

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v2]

2024-10-14 Thread Abhishek Kumar
On Mon, 14 Oct 2024 15:35:47 GMT, Alexey Ivanov wrote: >> Yeah, this is an option. As I mentioned earlier that MouseMotionListener is >> not needed, so creating an eventHandler object may not be of great use. I >> agree if more than one listener needs to be added, creating an eventHandler >> o

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v2]

2024-10-14 Thread Alexey Ivanov
On Mon, 14 Oct 2024 15:16:01 GMT, Abhishek Kumar wrote: >> Why? >> >> This comment is meant for the `modelArmed` flag. The way it's used now is >> thread-safe because of using `mouseEntered`, specifically a value is written >> to the flag before `mouseEntered.countDown()` is called, and its va

Re: RFR: 8341982: Simplify JButton/bug4323121.java [v2]

2024-10-14 Thread Alexey Ivanov
> 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 >

Re: RFR: 8341982: Simplify JButton/bug4323121.java

2024-10-14 Thread Abhishek Kumar
On Mon, 14 Oct 2024 15:00:17 GMT, Alexey Ivanov wrote: >> test/jdk/javax/swing/JButton/bug4323121.java line 69: >> >>> 67: SwingUtilities.invokeAndWait(() -> { >>> 68: button = new TestButton("gotcha"); >>> 69: button.addMouseMotionListener(eventHandle

Re: RFR: 8341982: Simplify JButton/bug4323121.java

2024-10-14 Thread Abhishek Kumar
On Mon, 14 Oct 2024 13:59:58 GMT, Alexey Ivanov wrote: >> test/jdk/javax/swing/JButton/bug4323121.java line 58: >> >>> 56: private static final CountDownLatch mouseEntered = new >>> CountDownLatch(1); >>> 57: >>> 58: // Thread-safe by using the mouseEntered latch >> >> Comment may be

Re: RFR: 8341982: Simplify JButton/bug4323121.java

2024-10-14 Thread Alexey Ivanov
On Mon, 14 Oct 2024 06:33:52 GMT, Abhishek Kumar 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 sti

Re: RFR: 8341982: Simplify JButton/bug4323121.java

2024-10-14 Thread Abhishek Kumar
On Fri, 11 Oct 2024 18:20:52 GMT, Alexey Ivanov 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 verifi