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

Phil Race prr at openjdk.org
Tue Jul 8 19:09:04 UTC 2025


On Thu, 8 May 2025 21:24:28 GMT, Phil Race <prr at openjdk.org> wrote:

>> src/java.desktop/share/classes/java/awt/Robot.java line 792:
>> 
>>> 790:      * and {@code mouseRelease}. Invokes {@code waitForIdle} with a default {@link #DEFAULT_DELAY delay} after
>>> 791:      * {@code mousePress} and {@code mouseRelease} calls. For specifics on valid inputs please see
>>> 792:      * {@link java.awt.Robot#mousePress(int)}.
>> 
>> It's discussable, and I may be wrong, but I'm not a fan of documentation that is very specific about its implementation.
>> I prefer the one that was before in the `ExtendedRobot`.
>> 
>> 
>> Clicks mouse button(s) by calling {@link #mousePress(int)} and {@link #mouseRelease(int)} methods
>
> I understand the concern but in this case it is more or less explanation of what the method does. Perhaps it can be adjusted or made in to an apiNote or whatever is best.

If this method doesn't call waitForIdle there's no reason to  document here that you'll get IllegalThreadStateException if called on the EDT, and waitForIdle is the sole source of ITSE.
So since we are obliged to document the IllegalThreadStateException I don't think it does any harm to say it calls waitForIdle.

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

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


More information about the client-libs-dev mailing list