--- jsr166/src/test/tck/ThreadLocalTest.java 2014/12/31 16:44:02 1.14 +++ jsr166/src/test/tck/ThreadLocalTest.java 2021/01/27 01:57:24 1.19 @@ -6,31 +6,32 @@ * Pat Fisher, Mike Judd. */ -import junit.framework.*; +import junit.framework.Test; +import junit.framework.TestSuite; public class ThreadLocalTest extends JSR166TestCase { public static void main(String[] args) { - junit.textui.TestRunner.run(suite()); + main(suite(), args); } public static Test suite() { return new TestSuite(ThreadLocalTest.class); } - static ThreadLocal tl = new ThreadLocal() { - public Integer initialValue() { + static ThreadLocal tl = new ThreadLocal<>() { + public Item initialValue() { return one; } }; - static InheritableThreadLocal itl = - new InheritableThreadLocal() { - protected Integer initialValue() { + static InheritableThreadLocal itl = + new InheritableThreadLocal<>() { + protected Item initialValue() { return zero; } - protected Integer childValue(Integer parentValue) { - return new Integer(parentValue.intValue() + 1); + protected Item childValue(Item parentValue) { + return new Item(parentValue.intValue() + 1); } }; @@ -89,7 +90,7 @@ public class ThreadLocalTest extends JSR */ public void testGenericITL() throws InterruptedException { final int threadCount = 10; - final int x[] = new int[threadCount]; + final int[] x = new int[threadCount]; Thread progenitor = new ITLThread(x); progenitor.start(); progenitor.join();