RFR: 8150564: Migrate useful ExtendedRobot methods into awt.Robot [v2]

Sergey Bylokhov serb at openjdk.org
Thu Aug 28 06:30:46 UTC 2025


On Wed, 27 Aug 2025 21:22:01 GMT, Damon Nguyen <dnguyen at openjdk.org> wrote:

>> Some useful methods (click, glide, waitForIdle, type) in ExtendedRobot should be migrated into Robot itself so that ExtendedRobot can be removed in the future. The tests using these ExtendedRobot methods will be handled separately.
>
> Damon Nguyen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Make vars static

src/java.desktop/share/classes/java/awt/Robot.java line 130:

> 128: 
> 129:     /**
> 130:      * Default step-delay in milliseconds for mouse {@link #glide(int, int, int, int) glide}.

Please split long lines to use 80 chars per line.

src/java.desktop/share/classes/java/awt/Robot.java line 812:

> 810:     public void click(int buttons) {
> 811:         mousePress(buttons);
> 812:         waitForIdle(20);

DEFAULT_STEP_DELAY?

src/java.desktop/share/classes/java/awt/Robot.java line 813:

> 811:         mousePress(buttons);
> 812:         waitForIdle(20);
> 813:         mouseRelease(buttons);

It would be good to call ***release methods in the finally block.

src/java.desktop/share/classes/java/awt/Robot.java line 970:

> 968:      * @since   26
> 969:      */
> 970:     public synchronized void type(int keycode) {

Is there any reason why this method is synchronized? Do we want to support mutithreaded execution of these methods?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26969#discussion_r2306316002
PR Review Comment: https://git.openjdk.org/jdk/pull/26969#discussion_r2306333411
PR Review Comment: https://git.openjdk.org/jdk/pull/26969#discussion_r2306332163
PR Review Comment: https://git.openjdk.org/jdk/pull/26969#discussion_r2306324745


More information about the client-libs-dev mailing list