Hi David, I'm still hoping to persuade you (and others) to fix the long-standing return-early bug in Object.wait.
As new support for my position I offer the "at least" in JLS https://docs.oracle.com/javase/specs/jls/se8/html/jls-17.html#jls-17.2.1 """ If this is a timed wait, an internal action removing t from m's wait set that occurs after at least millisecs milliseconds plusnanosecs nanoseconds elapse since the beginning of this wait action. """ --- a/src/java.base/share/classes/java/lang/Object.java +++ b/src/java.base/share/classes/java/lang/Object.java @@ -444,16 +444,17 @@ * this exception is thrown. */ public final void wait(long timeout, int nanos) throws InterruptedException { - if (timeout < 0) { - throw new IllegalArgumentException("timeout value is negative"); - } + if (nanos != 0) { + if (timeout < 0) { + throw new IllegalArgumentException + ("timeout value is negative"); + } - if (nanos < 0 || nanos > 999999) { - throw new IllegalArgumentException( - "nanosecond timeout value out of range"); - } + if (nanos < 0 || nanos > 999999) { + throw new IllegalArgumentException + ("nanosecond timeout value out of range"); + } - if (nanos >= 500000 || (nanos != 0 && timeout == 0)) { timeout++; } On Mon, Nov 17, 2014 at 6:11 PM, David Holmes <david.hol...@oracle.com> wrote: >> On 11/17/2014 2:54 PM, Martin Buchholz wrote: >>> >>> Returning early is EVIL. > > > Yet every OS seems to allow it <sigh>