--- jsr166/src/test/tck/ForkJoinTaskTest.java 2010/11/22 22:45:49 1.28 +++ jsr166/src/test/tck/ForkJoinTaskTest.java 2011/05/27 19:42:42 1.33 @@ -1,7 +1,7 @@ /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ import java.util.concurrent.ExecutionException; import java.util.concurrent.CancellationException; @@ -99,7 +99,7 @@ public class ForkJoinTaskTest extends JS long t0 = System.nanoTime(); assertSame(expected, a.join()); assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS); - assertTrue(Thread.interrupted()); + Thread.interrupted(); } { @@ -107,7 +107,7 @@ public class ForkJoinTaskTest extends JS long t0 = System.nanoTime(); a.quietlyJoin(); // should be no-op assertTrue(millisElapsedSince(t0) < SMALL_DELAY_MS); - assertTrue(Thread.interrupted()); + Thread.interrupted(); } assertFalse(a.cancel(false)); @@ -135,8 +135,8 @@ public class ForkJoinTaskTest extends JS a.join(); shouldThrow(); } catch (CancellationException success) { - assertTrue(Thread.interrupted()); } catch (Throwable fail) { threadUnexpectedException(fail); } + Thread.interrupted(); { long t0 = System.nanoTime(); @@ -162,7 +162,7 @@ public class ForkJoinTaskTest extends JS assertFalse(a.isCancelled()); assertFalse(a.isCompletedNormally()); assertTrue(a.isCompletedAbnormally()); - assertSame(t, a.getException()); + assertSame(t.getClass(), a.getException().getClass()); assertNull(a.getRawResult()); assertFalse(a.cancel(false)); assertFalse(a.cancel(true)); @@ -172,9 +172,9 @@ public class ForkJoinTaskTest extends JS a.join(); shouldThrow(); } catch (Throwable expected) { - assertTrue(Thread.interrupted()); - assertSame(t, expected); + assertSame(t.getClass(), expected.getClass()); } + Thread.interrupted(); { long t0 = System.nanoTime(); @@ -186,14 +186,14 @@ public class ForkJoinTaskTest extends JS a.get(); shouldThrow(); } catch (ExecutionException success) { - assertSame(t, success.getCause()); + assertSame(t.getClass(), success.getCause().getClass()); } catch (Throwable fail) { threadUnexpectedException(fail); } try { a.get(5L, SECONDS); shouldThrow(); } catch (ExecutionException success) { - assertSame(t, success.getCause()); + assertSame(t.getClass(), success.getCause().getClass()); } catch (Throwable fail) { threadUnexpectedException(fail); } } @@ -205,7 +205,7 @@ public class ForkJoinTaskTest extends JS * differently than supplied Recursive forms. */ - static final class FJException extends RuntimeException { + public static final class FJException extends RuntimeException { FJException() { super(); } } @@ -349,7 +349,6 @@ public class ForkJoinTaskTest extends JS } } - static final class FailingAsyncFib extends BinaryAsyncAction { int number; public FailingAsyncFib(int n) { @@ -486,7 +485,6 @@ public class ForkJoinTaskTest extends JS testInvokeOnPool(mainPool(), a); } - /** * helpQuiesce returns when tasks are complete. * getQueuedTaskCount returns 0 when quiescent @@ -496,7 +494,7 @@ public class ForkJoinTaskTest extends JS public void realCompute() { AsyncFib f = new AsyncFib(8); assertSame(f, f.fork()); - f.helpQuiesce(); + helpQuiesce(); assertEquals(21, f.number); assertEquals(0, getQueuedTaskCount()); checkCompletedNormally(f); @@ -504,7 +502,6 @@ public class ForkJoinTaskTest extends JS testInvokeOnPool(mainPool(), a); } - /** * invoke task throws exception when task completes abnormally */ @@ -849,7 +846,6 @@ public class ForkJoinTaskTest extends JS testInvokeOnPool(mainPool(), a); } - /** * invokeAll(tasks) with any null task throws NPE */ @@ -1213,7 +1209,6 @@ public class ForkJoinTaskTest extends JS testInvokeOnPool(singletonPool(), a); } - /** * helpQuiesce returns when tasks are complete. * getQueuedTaskCount returns 0 when quiescent @@ -1223,7 +1218,7 @@ public class ForkJoinTaskTest extends JS public void realCompute() { AsyncFib f = new AsyncFib(8); assertSame(f, f.fork()); - f.helpQuiesce(); + helpQuiesce(); assertEquals(0, getQueuedTaskCount()); assertEquals(21, f.number); checkCompletedNormally(f); @@ -1231,7 +1226,6 @@ public class ForkJoinTaskTest extends JS testInvokeOnPool(singletonPool(), a); } - /** * invoke task throws exception when task completes abnormally */ @@ -1519,7 +1513,6 @@ public class ForkJoinTaskTest extends JS testInvokeOnPool(singletonPool(), a); } - /** * invokeAll(tasks) with any null task throws NPE */