mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-03 06:58:23 +00:00
8072656: test/java/lang/reflect/Proxy/ClassRestrictions.java assumes app class loader be URLClassLoader
Reviewed-by: lancea, alanb
This commit is contained in:
parent
3bbf6fb281
commit
db4c181844
@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
/* @test
|
||||
* @bug 4227192 8004928
|
||||
* @bug 4227192 8004928 8072656
|
||||
* @summary This is a test of the restrictions on the parameters that may
|
||||
* be passed to the Proxy.getProxyClass method.
|
||||
* @author Peter Jones
|
||||
@ -31,9 +31,12 @@
|
||||
* @run main ClassRestrictions
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.net.URLClassLoader;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
public class ClassRestrictions {
|
||||
|
||||
@ -105,8 +108,13 @@ public class ClassRestrictions {
|
||||
* All of the interfaces types must be visible by name though the
|
||||
* specified class loader.
|
||||
*/
|
||||
ClassLoader altLoader = new URLClassLoader(
|
||||
((URLClassLoader) loader).getURLs(), null);
|
||||
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();
|
||||
}
|
||||
ClassLoader altLoader = new URLClassLoader(urls, null);
|
||||
Class altBarClass;
|
||||
altBarClass = Class.forName(Bar.class.getName(), false, altLoader);
|
||||
try {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user