RFR: 8345144: Robot does not specify all causes of IllegalThreadStateException
Harshitha Onkar
honkar at openjdk.org
Mon Dec 9 20:49:36 UTC 2024
On Wed, 4 Dec 2024 22:33:41 GMT, Alisen Chung <achung at openjdk.org> wrote:
> When robot.autoWaitForIdle is set to true, all mouse and key-related methods when invoked on the EDT will throw java.lang.IllegalThreadStateException which is not in the Robot specification.
>
> This PR updates the specification by adding warnings to avoid calling lengthy and delay-type methods on EDT and including exceptions thrown when autoWaitForIdle is set to true and mouse/key-handling methods are called on the EDT.
Doc changes look good to me. As @kumarabhi006 pointed, a corresponding CSR is required.
I have the same question as @azvegint suggested earlier: In case of robot.delay() is it good to have a recommendation - "to not call on EDT" or would it be better if the check is done by the method itself to avoid relying on the end-user to check it?
public void delay(int ms) {
if (isEventDispatchThread()) {
throw new IllegalThreadStateException("delay() called on EDT");
}
-------------
PR Review: https://git.openjdk.org/jdk/pull/22564#pullrequestreview-2490046593
More information about the client-libs-dev
mailing list