<AWT Dev>  Review Request: 8210231 Robot.delay() catches InterruptedException and prints stacktrace to stderr.
Sergey.Bylokhov at oracle.com
Mon Apr 15 03:24:59 UTC 2019
Here is another proposal:
1. This version describes what happens if the thread will be interrupted while waiting.
2. The reference to the "Thread.sleep()" was removed, because it is not a part of the spec for the current method.
3. "synchronized" keyword was removed, because of this bug: "if two threads call delay(1000) at around the same time then one of them will be a delay for 2000ms".
> Please review the fix for jdk12.
> Bug: https://bugs.openjdk.java.net/browse/JDK-8210231
> Webrev: http://cr.openjdk.java.net/~serb/8210231/webrev.00
> The Robot.delay() is a simple wrapper on top of Thread.sleep(), which ignores the InterruptedException. But in case of InterruptedException it prints the stack trace, which is unspecified behavior.
> In the fix the "printStackTrace()" was removed, and the interrupted state of the thread is restored.
Best regards, Sergey.
More information about the awt-dev