ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/JSR166TestCase.java
(Generate patch)

Comparing jsr166/src/test/tck/JSR166TestCase.java (file contents):
Revision 1.243 by jsr166, Thu Apr 5 03:36:54 2018 UTC vs.
Revision 1.246 by jsr166, Sun Jul 22 21:25:16 2018 UTC

# Line 451 | Line 451 | public class JSR166TestCase extends Test
451      public static boolean atLeastJava8()  { return JAVA_CLASS_VERSION >= 52.0; }
452      public static boolean atLeastJava9()  { return JAVA_CLASS_VERSION >= 53.0; }
453      public static boolean atLeastJava10() { return JAVA_CLASS_VERSION >= 54.0; }
454 +    public static boolean atLeastJava11() { return JAVA_CLASS_VERSION >= 55.0; }
455  
456      /**
457       * Collects all JSR166 unit tests as one suite.
# Line 1387 | Line 1388 | public class JSR166TestCase extends Test
1388       */
1389      <T> void checkTimedGet(Future<T> f, T expectedValue, long timeoutMillis) {
1390          long startTime = System.nanoTime();
1391 +        T actual = null;
1392          try {
1393 <            assertEquals(expectedValue, f.get(timeoutMillis, MILLISECONDS));
1393 >            actual = f.get(timeoutMillis, MILLISECONDS);
1394          } catch (Throwable fail) { threadUnexpectedException(fail); }
1395 +        assertEquals(expectedValue, actual);
1396          if (millisElapsedSince(startTime) > timeoutMillis/2)
1397              throw new AssertionError("timed get did not return promptly");
1398      }
# Line 1568 | Line 1571 | public class JSR166TestCase extends Test
1571      }
1572  
1573      public void await(CountDownLatch latch, long timeoutMillis) {
1574 +        boolean timedOut = false;
1575          try {
1576 <            if (!latch.await(timeoutMillis, MILLISECONDS))
1573 <                fail("timed out waiting for CountDownLatch for "
1574 <                     + (timeoutMillis/1000) + " sec");
1576 >            timedOut = !latch.await(timeoutMillis, MILLISECONDS);
1577          } catch (Throwable fail) {
1578              threadUnexpectedException(fail);
1579          }
1580 +        if (timedOut)
1581 +            fail("timed out waiting for CountDownLatch for "
1582 +                 + (timeoutMillis/1000) + " sec");
1583      }
1584  
1585      public void await(CountDownLatch latch) {
# Line 1582 | Line 1587 | public class JSR166TestCase extends Test
1587      }
1588  
1589      public void await(Semaphore semaphore) {
1590 +        boolean timedOut = false;
1591          try {
1592 <            if (!semaphore.tryAcquire(LONG_DELAY_MS, MILLISECONDS))
1587 <                fail("timed out waiting for Semaphore for "
1588 <                     + (LONG_DELAY_MS/1000) + " sec");
1592 >            timedOut = !semaphore.tryAcquire(LONG_DELAY_MS, MILLISECONDS);
1593          } catch (Throwable fail) {
1594              threadUnexpectedException(fail);
1595          }
1596 +        if (timedOut)
1597 +            fail("timed out waiting for Semaphore for "
1598 +                 + (LONG_DELAY_MS/1000) + " sec");
1599      }
1600  
1601      public void await(CyclicBarrier barrier) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines