On Tue, 21 Nov 2023 08:40:40 GMT, songpv-imt <d...@openjdk.org> wrote:

>> The root cause of the bug is because mousePress() method is invoked before 
>> mouseMove() event is completely processed causing the drag & drop behavior 
>> not being able to be recognized properly. This in turn makes the method 
>> dragSourceListener.isDropFinished() returns false and fail the test. To fix 
>> this, setAutoWaitForIdle(true) and Thread.Sleep is called to make sure the 
>> mouseMove() event is processed completely before moving to execute the 
>> mousePress() method.
>> 
>> JBS issue: [JDK-8317287](https://bugs.openjdk.org/browse/JDK-8317287)
>
> songpv-imt has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Update InterJVMGetDropSuccessTest.java
>   Instead of using SYNC_LOCK to synchronize accessing the listener's fields, 
> for better code transparency, we have placed the code that accesses the 
> listener's fields from the main thread into the AWT Event Queue.

test/jdk/java/awt/dnd/InterJVMGetDropSuccessTest/InterJVMGetDropSuccessTest.java
 line 273:

> 271:             robot.setAutoWaitForIdle(true);
> 272:             robot.mouseMove(sourcePoint.x, sourcePoint.y);
> 273:             Thread.sleep(50);

Suggestion:

            robot.delay(50);

Using `Robot.delay` is more common in tests, and it doesn't throw 
`InterruptedException`.

test/jdk/java/awt/dnd/InterJVMGetDropSuccessTest/InterJVMGetDropSuccessTest.java
 line 287:

> 285:             }
> 286: 
> 287:             EventQueue.invokeAndWait(()-> {

Suggestion:

            EventQueue.invokeAndWait(() -> {

Added a space to follow the common code style.

test/jdk/java/awt/dnd/InterJVMGetDropSuccessTest/InterJVMGetDropSuccessTest.java
 line 335:

> 333:         }
> 334:     } // run()
> 335: } // class child

Please keep one blank line in the end of the files.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16396#discussion_r1428090457
PR Review Comment: https://git.openjdk.org/jdk/pull/16396#discussion_r1428093169
PR Review Comment: https://git.openjdk.org/jdk/pull/16396#discussion_r1428092599

Reply via email to