221 |
|
} |
222 |
|
|
223 |
|
public static final double JAVA_CLASS_VERSION; |
224 |
+ |
public static final String JAVA_SPECIFICATION_VERSION; |
225 |
|
static { |
226 |
|
try { |
227 |
|
JAVA_CLASS_VERSION = java.security.AccessController.doPrivileged( |
228 |
|
new java.security.PrivilegedAction<Double>() { |
229 |
|
public Double run() { |
230 |
|
return Double.valueOf(System.getProperty("java.class.version"));}}); |
231 |
+ |
JAVA_SPECIFICATION_VERSION = java.security.AccessController.doPrivileged( |
232 |
+ |
new java.security.PrivilegedAction<String>() { |
233 |
+ |
public String run() { |
234 |
+ |
return System.getProperty("java.specification.version");}}); |
235 |
|
} catch (Throwable t) { |
236 |
|
throw new Error(t); |
237 |
|
} |
240 |
|
public static boolean atLeastJava6() { return JAVA_CLASS_VERSION >= 50.0; } |
241 |
|
public static boolean atLeastJava7() { return JAVA_CLASS_VERSION >= 51.0; } |
242 |
|
public static boolean atLeastJava8() { return JAVA_CLASS_VERSION >= 52.0; } |
243 |
+ |
public static boolean atLeastJava9() { |
244 |
+ |
// As of 2014-05, java9 still uses 52.0 class file version |
245 |
+ |
return JAVA_SPECIFICATION_VERSION.startsWith("1.9"); |
246 |
+ |
} |
247 |
|
|
248 |
|
/** |
249 |
|
* Collects all JSR166 unit tests as one suite. |
336 |
|
addNamedTestClasses(suite, java8TestClassNames); |
337 |
|
} |
338 |
|
|
339 |
+ |
// Java9+ test classes |
340 |
+ |
if (atLeastJava9()) { |
341 |
+ |
String[] java9TestClassNames = { |
342 |
+ |
"ThreadPoolExecutor9Test", |
343 |
+ |
}; |
344 |
+ |
addNamedTestClasses(suite, java9TestClassNames); |
345 |
+ |
} |
346 |
+ |
|
347 |
|
return suite; |
348 |
|
} |
349 |
|
|