mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-17 18:30:27 +00:00
8104574: Update tests to prepare for system class loader not be URLClassLoader
Reviewed-by: chegar
This commit is contained in:
parent
9bb445c368
commit
8bc30fb3c8
@ -28,8 +28,11 @@
|
||||
* @run testng ThreadSafety
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.BrokenBarrierException;
|
||||
import java.util.concurrent.Callable;
|
||||
@ -71,9 +74,13 @@ public class ThreadSafety {
|
||||
/** published via data race */
|
||||
private Class<?> racyClass = Object.class;
|
||||
|
||||
private URL[] urls = ((URLClassLoader) ThreadSafety.class.getClassLoader()).getURLs();
|
||||
|
||||
private Class<?> createNewEmptyGenericSubclassClass() throws Exception {
|
||||
String[] cpaths = System.getProperty("test.classes", ".")
|
||||
.split(File.pathSeparator);
|
||||
URL[] urls = new URL[cpaths.length];
|
||||
for (int i=0; i < cpaths.length; i++) {
|
||||
urls[i] = Paths.get(cpaths[i]).toUri().toURL();
|
||||
}
|
||||
URLClassLoader ucl = new URLClassLoader(urls, null);
|
||||
return Class.forName("ThreadSafety$EmptyClass$EmptyGenericSubclass", true, ucl);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user