--- jsr166/src/test/tck/RecursiveTaskTest.java 2010/11/22 07:45:50 1.24 +++ jsr166/src/test/tck/RecursiveTaskTest.java 2011/03/15 19:47:07 1.27 @@ -1,13 +1,14 @@ /* * 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 junit.framework.*; import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; import java.util.concurrent.ForkJoinPool; +import java.util.concurrent.ForkJoinTask; import java.util.concurrent.ForkJoinWorkerThread; import java.util.concurrent.RecursiveTask; import java.util.concurrent.TimeUnit; @@ -59,7 +60,7 @@ public class RecursiveTaskTest extends J assertNull(a.getException()); assertNull(a.getRawResult()); - if (! (Thread.currentThread() instanceof ForkJoinWorkerThread)) { + if (! ForkJoinTask.inForkJoinPool()) { Thread.currentThread().interrupt(); try { a.get(); @@ -152,7 +153,7 @@ public class RecursiveTaskTest extends J 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)); @@ -161,26 +162,26 @@ public class RecursiveTaskTest extends J a.join(); shouldThrow(); } catch (Throwable expected) { - assertSame(t, expected); + assertSame(t.getClass(), expected.getClass()); } try { 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); } } - static final class FJException extends RuntimeException { - FJException() { super(); } + public static final class FJException extends RuntimeException { + public FJException() { super(); } } // An invalid return value for Fib