--- jsr166/src/test/tck/JSR166TestCase.java 2015/10/04 00:30:50 1.159 +++ jsr166/src/test/tck/JSR166TestCase.java 2015/10/04 00:59:09 1.160 @@ -770,15 +770,14 @@ public class JSR166TestCase extends Test /** * Allows use of try-with-resources with per-test thread pools. */ - class PoolCleaner - implements AutoCloseable { - public final T pool; - public PoolCleaner(T pool) { this.pool = pool; } + class PoolCleaner implements AutoCloseable { + private final ExecutorService pool; + public PoolCleaner(ExecutorService pool) { this.pool = pool; } public void close() { joinPool(pool); } } - PoolCleaner cleaner(T pool) { - return new PoolCleaner(pool); + PoolCleaner cleaner(ExecutorService pool) { + return new PoolCleaner(pool); } /** @@ -813,9 +812,8 @@ public class JSR166TestCase extends Test * necessarily individually slow because they must block. */ void testInParallel(Action ... actions) { - try (PoolCleaner cleaner - = cleaner(Executors.newCachedThreadPool())) { - ExecutorService pool = cleaner.pool; + ExecutorService pool = Executors.newCachedThreadPool(); + try (PoolCleaner cleaner = cleaner(pool)) { ArrayList> futures = new ArrayList<>(actions.length); for (final Action action : actions) futures.add(pool.submit(new CheckedRunnable() {