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.234 by jsr166, Mon Jul 17 22:27:31 2017 UTC vs.
Revision 1.238 by jsr166, Mon Dec 11 00:27:08 2017 UTC

# Line 445 | Line 445 | public class JSR166TestCase extends Test
445          }
446      }
447  
448 <    public static boolean atLeastJava6() { return JAVA_CLASS_VERSION >= 50.0; }
449 <    public static boolean atLeastJava7() { return JAVA_CLASS_VERSION >= 51.0; }
450 <    public static boolean atLeastJava8() { return JAVA_CLASS_VERSION >= 52.0; }
451 <    public static boolean atLeastJava9() {
452 <        return JAVA_CLASS_VERSION >= 53.0
453 <            // As of 2015-09, java9 still uses 52.0 class file version
454 <            || JAVA_SPECIFICATION_VERSION.matches("^(1\\.)?(9|[0-9][0-9])$");
455 <    }
456 <    public static boolean atLeastJava10() {
457 <        return JAVA_CLASS_VERSION >= 54.0
458 <            || JAVA_SPECIFICATION_VERSION.matches("^(1\\.)?[0-9][0-9]$");
459 <    }
448 >    public static boolean atLeastJava6()  { return JAVA_CLASS_VERSION >= 50.0; }
449 >    public static boolean atLeastJava7()  { return JAVA_CLASS_VERSION >= 51.0; }
450 >    public static boolean atLeastJava8()  { return JAVA_CLASS_VERSION >= 52.0; }
451 >    public static boolean atLeastJava9()  { return JAVA_CLASS_VERSION >= 53.0; }
452 >    public static boolean atLeastJava10() { return JAVA_CLASS_VERSION >= 54.0; }
453  
454      /**
455       * Collects all JSR166 unit tests as one suite.
# Line 544 | Line 537 | public class JSR166TestCase extends Test
537                  "DoubleAdderTest",
538                  "ForkJoinPool8Test",
539                  "ForkJoinTask8Test",
540 +                "HashMapTest",
541                  "LinkedBlockingDeque8Test",
542                  "LinkedBlockingQueue8Test",
543                  "LongAccumulatorTest",
# Line 1116 | Line 1110 | public class JSR166TestCase extends Test
1110      }
1111  
1112      /**
1119     * Checks that thread does not terminate within the default
1120     * millisecond delay of {@code timeoutMillis()}.
1121     * TODO: REMOVEME
1122     */
1123    void assertThreadStaysAlive(Thread thread) {
1124        assertThreadStaysAlive(thread, timeoutMillis());
1125    }
1126
1127    /**
1128     * Checks that thread does not terminate within the given millisecond delay.
1129     * TODO: REMOVEME
1130     */
1131    void assertThreadStaysAlive(Thread thread, long millis) {
1132        try {
1133            // No need to optimize the failing case via Thread.join.
1134            delay(millis);
1135            assertTrue(thread.isAlive());
1136        } catch (InterruptedException fail) {
1137            threadFail("Unexpected InterruptedException");
1138        }
1139    }
1140
1141    /**
1142     * Checks that the threads do not terminate within the default
1143     * millisecond delay of {@code timeoutMillis()}.
1144     * TODO: REMOVEME
1145     */
1146    void assertThreadsStayAlive(Thread... threads) {
1147        assertThreadsStayAlive(timeoutMillis(), threads);
1148    }
1149
1150    /**
1151     * Checks that the threads do not terminate within the given millisecond delay.
1152     * TODO: REMOVEME
1153     */
1154    void assertThreadsStayAlive(long millis, Thread... threads) {
1155        try {
1156            // No need to optimize the failing case via Thread.join.
1157            delay(millis);
1158            for (Thread thread : threads)
1159                assertTrue(thread.isAlive());
1160        } catch (InterruptedException fail) {
1161            threadFail("Unexpected InterruptedException");
1162        }
1163    }
1164
1165    /**
1113       * Checks that future.get times out, with the default timeout of
1114       * {@code timeoutMillis()}.
1115       */
# Line 1960 | Line 1907 | public class JSR166TestCase extends Test
1907          Collections.shuffle(Arrays.asList(array), ThreadLocalRandom.current());
1908      }
1909  
1910 +    /**
1911 +     * Returns the same String as would be returned by {@link
1912 +     * Object#toString}, whether or not the given object's class
1913 +     * overrides toString().
1914 +     *
1915 +     * @see System#identityHashCode
1916 +     */
1917 +    static String identityString(Object x) {
1918 +        return x.getClass().getName()
1919 +            + "@" + Integer.toHexString(System.identityHashCode(x));
1920 +    }
1921 +
1922      // --- Shared assertions for Executor tests ---
1923  
1924      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines