ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/AbstractExecutorServiceTest.java
(Generate patch)

Comparing jsr166/src/test/tck/AbstractExecutorServiceTest.java (file contents):
Revision 1.47 by jsr166, Sun Jul 16 18:05:47 2017 UTC vs.
Revision 1.49 by dl, Tue Jan 26 13:33:05 2021 UTC

# Line 47 | Line 47 | public class AbstractExecutorServiceTest
47          public void shutdown() { shutdown = true; }
48          public List<Runnable> shutdownNow() {
49              shutdown = true;
50 <            return Collections.EMPTY_LIST;
50 >            return Collections.emptyList();
51          }
52          public boolean isShutdown() { return shutdown; }
53          public boolean isTerminated() { return isShutdown(); }
# Line 111 | Line 111 | public class AbstractExecutorServiceTest
111          Runnable r = new CheckedRunnable() {
112              public void realRun() throws Exception {
113                  ExecutorService e = new DirectExecutorService();
114 <                Future future = e.submit(Executors.callable(new PrivilegedAction() {
114 >                Future<?> future = e.submit(Executors.callable(new PrivilegedAction<Object>() {
115                      public Object run() {
116                          return TEST_STRING;
117                      }}));
# Line 132 | Line 132 | public class AbstractExecutorServiceTest
132          Runnable r = new CheckedRunnable() {
133              public void realRun() throws Exception {
134                  ExecutorService e = new DirectExecutorService();
135 <                Future future = e.submit(Executors.callable(new PrivilegedExceptionAction() {
135 >                Future<?> future = e.submit(Executors.callable(new PrivilegedExceptionAction<Object>() {
136                      public Object run() {
137                          return TEST_STRING;
138                      }}));
# Line 150 | Line 150 | public class AbstractExecutorServiceTest
150          Runnable r = new CheckedRunnable() {
151              public void realRun() throws Exception {
152                  ExecutorService e = new DirectExecutorService();
153 <                Future future = e.submit(Executors.callable(new PrivilegedExceptionAction() {
153 >                Future<?> future = e.submit(Executors.callable(new PrivilegedExceptionAction<Object>() {
154                      public Object run() throws Exception {
155                          throw new IndexOutOfBoundsException();
156                      }}));
# Line 166 | Line 166 | public class AbstractExecutorServiceTest
166      }
167  
168      /**
169 <     * Submitting null tasks throws NullPointerException.
169 >     * Submitting null tasks throws NullPointerException
170       */
171 <    @SuppressWarnings("FutureReturnValueIgnored")
172 <    public void testNullTaskSubmission() throws Exception {
171 >    public void testNullTaskSubmission() {
172          final ExecutorService e = new DirectExecutorService();
173          try (PoolCleaner cleaner = cleaner(e)) {
174 <            try {
176 <                e.execute((Runnable) null);
177 <                shouldThrow();
178 <            } catch (NullPointerException success) {}
179 <            try {
180 <                e.submit((Runnable) null);
181 <                shouldThrow();
182 <            } catch (NullPointerException success) {}
183 <            try {
184 <                e.submit((Callable) null);
185 <                shouldThrow();
186 <            } catch (NullPointerException success) {}
174 >            assertNullTaskSubmissionThrowsNullPointerException(e);
175          }
176      }
177  
# Line 225 | Line 213 | public class AbstractExecutorServiceTest
213                                     60, TimeUnit.SECONDS,
214                                     new ArrayBlockingQueue<Runnable>(10));
215          try (PoolCleaner cleaner = cleaner(p)) {
216 <            Callable c = new Callable() {
216 >            Callable<Object> c = new Callable<Object>() {
217                  public Object call() { throw new ArithmeticException(); }};
218              try {
219                  p.submit(c).get();
# Line 596 | Line 584 | public class AbstractExecutorServiceTest
584                      e.invokeAll(tasks, timeout, MILLISECONDS);
585                  assertEquals(tasks.size(), futures.size());
586                  assertTrue(millisElapsedSince(startTime) >= timeout);
587 <                for (Future future : futures)
587 >                for (Future<?> future : futures)
588                      assertTrue(future.isDone());
589                  try {
590                      assertEquals("0", futures.get(0).get());

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines