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

Comparing jsr166/src/test/tck/JSR166TestCase.java (file contents):
Revision 1.273 by jsr166, Wed Jan 27 02:13:22 2021 UTC vs.
Revision 1.274 by dl, Tue Mar 22 16:26:19 2022 UTC

# Line 195 | Line 195 | import junit.framework.TestSuite;
195   * </ul>
196   */
197   public class JSR166TestCase extends TestCase {
198 +    // No longer run with custom securityManagers
199      private static final boolean useSecurityManager =
200 <        Boolean.getBoolean("jsr166.useSecurityManager");
200 >    Boolean.getBoolean("jsr166.useSecurityManager");
201  
202      protected static final boolean expensiveTests =
203          Boolean.getBoolean("jsr166.expensiveTests");
# Line 407 | Line 408 | public class JSR166TestCase extends Test
408       * Runs all unit tests in the given test suite.
409       * Actual behavior influenced by jsr166.* system properties.
410       */
411 +    @SuppressWarnings("removal")
412      static void main(Test suite, String[] args) {
413          if (useSecurityManager) {
414              System.err.println("Setting a permissive security manager");
# Line 452 | Line 454 | public class JSR166TestCase extends Test
454      public static final String JAVA_SPECIFICATION_VERSION;
455      static {
456          try {
457 <            JAVA_CLASS_VERSION = java.security.AccessController.doPrivileged(
457 >            @SuppressWarnings("removal") double jcv =
458 >            java.security.AccessController.doPrivileged(
459                  new java.security.PrivilegedAction<Double>() {
460                  public Double run() {
461                      return Double.valueOf(System.getProperty("java.class.version"));}});
462 <            JAVA_SPECIFICATION_VERSION = java.security.AccessController.doPrivileged(
462 >            JAVA_CLASS_VERSION = jcv;
463 >            @SuppressWarnings("removal") String jsv =
464 >            java.security.AccessController.doPrivileged(
465                  new java.security.PrivilegedAction<String>() {
466                  public String run() {
467                      return System.getProperty("java.specification.version");}});
468 +            JAVA_SPECIFICATION_VERSION = jsv;
469          } catch (Throwable t) {
470              throw new Error(t);
471          }
# Line 596 | Line 602 | public class JSR166TestCase extends Test
602              addNamedTestClasses(suite, java9TestClassNames);
603          }
604  
605 +        if (atLeastJava17()) {
606 +            String[] java17TestClassNames = {
607 +                "ForkJoinPool19Test",
608 +            };
609 +            addNamedTestClasses(suite, java17TestClassNames);
610 +        }
611          return suite;
612      }
613  
# Line 1054 | Line 1066 | public class JSR166TestCase extends Test
1066      void joinPool(ExecutorService pool) {
1067          try {
1068              pool.shutdown();
1069 <            if (!pool.awaitTermination(2 * LONG_DELAY_MS, MILLISECONDS)) {
1069 >            if (!pool.awaitTermination(20 * LONG_DELAY_MS, MILLISECONDS)) {
1070                  try {
1071                      threadFail("ExecutorService " + pool +
1072                                 " did not terminate in a timely manner");
# Line 1138 | Line 1150 | public class JSR166TestCase extends Test
1150       * A debugging tool to print stack traces of most threads, as jstack does.
1151       * Uninteresting threads are filtered out.
1152       */
1153 +    @SuppressWarnings("removal")
1154      static void dumpTestThreads() {
1155          SecurityManager sm = System.getSecurityManager();
1156          if (sm != null) {
# Line 1346 | Line 1359 | public class JSR166TestCase extends Test
1359          assertTrue(c.remove(i));
1360      }
1361      static void mustNotRemove(Collection<Item> c, int i) {
1362 <        Item[] items = defaultItems;
1350 <        Item x = (i >= 0 && i < items.length) ? items[i] : new Item(i);
1351 <        assertFalse(c.remove(x));
1362 >        assertFalse(c.remove(itemFor(i)));
1363      }
1364      static void mustNotRemove(Collection<Item> c, Item i) {
1365          assertFalse(c.remove(i));
# Line 1373 | Line 1384 | public class JSR166TestCase extends Test
1384       * security manager.  We require that any security manager permit
1385       * getPolicy/setPolicy.
1386       */
1387 +    @SuppressWarnings("removal")
1388      public void runWithPermissions(Runnable r, Permission... permissions) {
1389          SecurityManager sm = System.getSecurityManager();
1390          if (sm == null) {
# Line 1388 | Line 1400 | public class JSR166TestCase extends Test
1400       * Runnable.  We require that any security manager permit
1401       * getPolicy/setPolicy.
1402       */
1403 +    @SuppressWarnings("removal")
1404      public void runWithSecurityManagerWithPermissions(Runnable r,
1405                                                        Permission... permissions) {
1406 +        if (!useSecurityManager) return;
1407          SecurityManager sm = System.getSecurityManager();
1408          if (sm == null) {
1409              Policy savedPolicy = Policy.getPolicy();
# Line 1426 | Line 1440 | public class JSR166TestCase extends Test
1440       * A security policy where new permissions can be dynamically added
1441       * or all cleared.
1442       */
1443 +    @SuppressWarnings("removal")
1444      public static class AdjustablePolicy extends java.security.Policy {
1445          Permissions perms = new Permissions();
1446          AdjustablePolicy(Permission... permissions) {
# Line 1455 | Line 1470 | public class JSR166TestCase extends Test
1470      /**
1471       * Returns a policy containing all the permissions we ever need.
1472       */
1473 +    @SuppressWarnings("removal")
1474      public static Policy permissivePolicy() {
1475          return new AdjustablePolicy
1476              // Permissions j.u.c. needs directly

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines