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

Phil Race prr at openjdk.org
Fri Jul 25 18:14:19 UTC 2025


On Wed, 23 Jul 2025 19:16:18 GMT, Alisen Chung <achung at openjdk.org> wrote:

>> Some useful methods in ExtendedRobot should be migrated into Robot itself so that ExtendedRobot can be removed in the future. The tests using ExtendedRobot for these migrated methods are changed to use only Robot (removing unnecessary building of ExtendedRobot).
>
> Alisen Chung has updated the pull request incrementally with one additional commit since the last revision:
> 
>   remove static from step delay/length fields

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

> 877:      * @param   destY  Destination point y coordinate
> 878:      *
> 879:      * @throws  IllegalArgumentException if {@code stepLength} is greater than the distance

In the CSR Joe asked if glide(int, int) needed to throw IAE and it made me look here and I don't actually see where this code would throw that. 
And the old extended robot never had such a feature, did it ?
Also if you think of glide as a sequence of steps, then even with the default of "2" if the distance to move is say "5" after 2 steps you are one pixel away and then I presume we just step one pixel for the final step.
So how is that different than STARTING one pixel away ?

Perhaps we can just dispense with the IAE and if dist < steplength then there's just one step.

test/jdk/lib/client/ExtendedRobot.java line 253:

> 251:      * @see     #delay(int)
> 252:      */
> 253:      public void glide(int srcX, int srcY, int destX, int destY, int stepLength, int speed) {

I hadn't noticed that this over-ride is both removed here and not added to Robot.
If this were available, then perhaps those setters and getters for the current values aren't needed !
What was the reason for not including it ? No one ever used it or something else ?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22044#discussion_r2231743079
PR Review Comment: https://git.openjdk.org/jdk/pull/22044#discussion_r2231735770


More information about the client-libs-dev mailing list