--- jsr166/src/test/tck/ExecutorsTest.java 2020/02/01 18:52:17 1.54 +++ jsr166/src/test/tck/ExecutorsTest.java 2022/03/22 21:29:23 1.56 @@ -206,7 +206,7 @@ public class ExecutorsTest extends JSR16 await(proceed); }}; long startTime = System.nanoTime(); - Future f = p.schedule(Executors.callable(task, Boolean.TRUE), + Future f = p.schedule(Executors.callable(task, Boolean.TRUE), timeoutMillis(), MILLISECONDS); assertFalse(f.isDone()); proceed.countDown(); @@ -230,7 +230,7 @@ public class ExecutorsTest extends JSR16 await(proceed); }}; long startTime = System.nanoTime(); - Future f = p.schedule(Executors.callable(task, Boolean.TRUE), + Future f = p.schedule(Executors.callable(task, Boolean.TRUE), timeoutMillis(), MILLISECONDS); assertFalse(f.isDone()); proceed.countDown(); @@ -256,7 +256,7 @@ public class ExecutorsTest extends JSR16 await(proceed); }}; long startTime = System.nanoTime(); - Future f = p.schedule(Executors.callable(task, Boolean.TRUE), + Future f = p.schedule(Executors.callable(task, Boolean.TRUE), timeoutMillis(), MILLISECONDS); assertFalse(f.isDone()); proceed.countDown(); @@ -290,7 +290,7 @@ public class ExecutorsTest extends JSR16 for (final ExecutorService executor : executors) { threads.add(newStartedThread(new CheckedRunnable() { public void realRun() { - Future future = executor.submit(sleeper); + Future future = executor.submit(sleeper); assertFutureTimesOut(future); }})); } @@ -305,6 +305,7 @@ public class ExecutorsTest extends JSR16 * ThreadPoolExecutor using defaultThreadFactory has * specified group, priority, daemon status, and name */ + @SuppressWarnings("removal") public void testDefaultThreadFactory() throws Exception { final ThreadGroup egroup = Thread.currentThread().getThreadGroup(); final CountDownLatch done = new CountDownLatch(1); @@ -335,6 +336,7 @@ public class ExecutorsTest extends JSR16 * specified group, priority, daemon status, name, * access control context and context class loader */ + @SuppressWarnings("removal") public void testPrivilegedThreadFactory() throws Exception { final CountDownLatch done = new CountDownLatch(1); Runnable r = new CheckedRunnable() { @@ -368,6 +370,7 @@ public class ExecutorsTest extends JSR16 new RuntimePermission("modifyThread")); } + @SuppressWarnings("removal") boolean haveCCLPermissions() { SecurityManager sm = System.getSecurityManager(); if (sm != null) { @@ -381,6 +384,7 @@ public class ExecutorsTest extends JSR16 return true; } + @SuppressWarnings("removal") void checkCCL() { SecurityManager sm = System.getSecurityManager(); if (sm != null) { @@ -400,6 +404,7 @@ public class ExecutorsTest extends JSR16 * Without class loader permissions, creating * privilegedCallableUsingCurrentClassLoader throws ACE */ + @SuppressWarnings("removal") public void testCreatePrivilegedCallableUsingCCLWithNoPrivs() { Runnable r = new CheckedRunnable() { public void realRun() throws Exception { @@ -418,6 +423,7 @@ public class ExecutorsTest extends JSR16 * With class loader permissions, calling * privilegedCallableUsingCurrentClassLoader does not throw ACE */ + @SuppressWarnings("removal") public void testPrivilegedCallableUsingCCLWithPrivs() throws Exception { Runnable r = new CheckedRunnable() { public void realRun() throws Exception { @@ -434,6 +440,7 @@ public class ExecutorsTest extends JSR16 /** * Without permissions, calling privilegedCallable throws ACE */ + @SuppressWarnings("removal") public void testPrivilegedCallableWithNoPrivs() throws Exception { // Avoid classloader-related SecurityExceptions in swingui.TestRunner Executors.privilegedCallable(new CheckCCL()); @@ -442,7 +449,7 @@ public class ExecutorsTest extends JSR16 public void realRun() throws Exception { if (System.getSecurityManager() == null) return; - Callable task = Executors.privilegedCallable(new CheckCCL()); + Callable task = Executors.privilegedCallable(new CheckCCL()); try { task.call(); shouldThrow(); @@ -506,6 +513,7 @@ public class ExecutorsTest extends JSR16 /** * With permissions, calling privilegedCallable succeeds */ + @SuppressWarnings("removal") public void testPrivilegedCallableWithPrivs() throws Exception { Runnable r = new CheckedRunnable() { public void realRun() throws Exception { @@ -521,7 +529,7 @@ public class ExecutorsTest extends JSR16 * callable(Runnable) returns null when called */ public void testCallable1() throws Exception { - Callable c = Executors.callable(new NoOpRunnable()); + Callable c = Executors.callable(new NoOpRunnable()); assertNull(c.call()); } @@ -529,7 +537,7 @@ public class ExecutorsTest extends JSR16 * callable(Runnable, result) returns result when called */ public void testCallable2() throws Exception { - Callable c = Executors.callable(new NoOpRunnable(), one); + Callable c = Executors.callable(new NoOpRunnable(), one); assertSame(one, c.call()); } @@ -537,7 +545,7 @@ public class ExecutorsTest extends JSR16 * callable(PrivilegedAction) returns its result when called */ public void testCallable3() throws Exception { - Callable c = Executors.callable(new PrivilegedAction() { + Callable c = Executors.callable(new PrivilegedAction() { public Object run() { return one; }}); assertSame(one, c.call()); } @@ -546,7 +554,7 @@ public class ExecutorsTest extends JSR16 * callable(PrivilegedExceptionAction) returns its result when called */ public void testCallable4() throws Exception { - Callable c = Executors.callable(new PrivilegedExceptionAction() { + Callable c = Executors.callable(new PrivilegedExceptionAction() { public Object run() { return one; }}); assertSame(one, c.call()); } @@ -556,7 +564,7 @@ public class ExecutorsTest extends JSR16 */ public void testCallableNPE1() { try { - Callable unused = Executors.callable((Runnable) null); + Callable unused = Executors.callable((Runnable) null); shouldThrow(); } catch (NullPointerException success) {} } @@ -566,7 +574,7 @@ public class ExecutorsTest extends JSR16 */ public void testCallableNPE2() { try { - Callable unused = Executors.callable((Runnable) null, one); + Callable unused = Executors.callable((Runnable) null, one); shouldThrow(); } catch (NullPointerException success) {} } @@ -576,7 +584,7 @@ public class ExecutorsTest extends JSR16 */ public void testCallableNPE3() { try { - Callable unused = Executors.callable((PrivilegedAction) null); + Callable unused = Executors.callable((PrivilegedAction) null); shouldThrow(); } catch (NullPointerException success) {} } @@ -586,7 +594,7 @@ public class ExecutorsTest extends JSR16 */ public void testCallableNPE4() { try { - Callable unused = Executors.callable((PrivilegedExceptionAction) null); + Callable unused = Executors.callable((PrivilegedExceptionAction) null); shouldThrow(); } catch (NullPointerException success) {} } @@ -620,6 +628,7 @@ public class ExecutorsTest extends JSR16 /** * privilegedCallable(callable).toString() contains toString of wrapped task */ + @SuppressWarnings("removal") public void testPrivilegedCallable_toString() { if (testImplementationDetails) { Callable c = () -> ""; @@ -634,6 +643,7 @@ public class ExecutorsTest extends JSR16 * privilegedCallableUsingCurrentClassLoader(callable).toString() * contains toString of wrapped task */ + @SuppressWarnings("removal") public void testPrivilegedCallableUsingCurrentClassLoader_toString() { if (testImplementationDetails) { Callable c = () -> "";