Proxy.java (generate): Uncomment protection domain code.

* java/lang/reflect/Proxy.java (generate): Uncomment protection
	domain code.
	* java/lang/natClassLoader.cc (defineClass): Added `loader'
	argument.
	(linkClass0): Now in VMClassLoader.
	(markClassErrorState0): Likewise.
	(getSystemClassLoaderInternal): New method.
	* java/lang/natClass.cc (initializeClass): Use
	VMClassLoader::resolveClass.
	* java/lang/ClassLoader.java: New version, from Classpath.
	* java/lang/Class.java (getProtectionDomain):
	protectionDomainPermission and unknownProtectionDomain now in
	VMClassLoader.
	* java/lang/Class.h: VMClassLoader now a friend class.
	* gnu/gcj/runtime/VMClassLoader.java (instance): Now
	package-private.
	* gcj/javaprims.h: Regenerated class list.
	* resolve.cc (_Jv_PrepareClass): Use VMClassLoader::resolveClass.
	* java/lang/VMClassLoader.java: New version from Classpath;
	modified for libgcj use.

From-SVN: r71765
This commit is contained in:
Tom Tromey 2003-09-25 07:46:19 +00:00 committed by Tom Tromey
parent d70f15d251
commit b9f42bb060
11 changed files with 910 additions and 720 deletions

View file

@ -1335,17 +1335,10 @@ public class Proxy implements Serializable
{
// XXX Do we require more native support here?
// XXX Security hole - it is possible for another thread to grab the
// VMClassLoader.defineClass Method object, and abuse it while we
// have temporarily made it accessible. Do we need to add some
// synchronization lock to prevent user reflection while we use it?
// XXX This is waiting on VM support for protection domains.
Class vmClassLoader = Class.forName("java.lang.VMClassLoader");
Class[] types = {ClassLoader.class, String.class,
byte[].class, int.class, int.class,
/* ProtectionDomain.class */ };
ProtectionDomain.class };
Method m = vmClassLoader.getDeclaredMethod("defineClass", types);
// Bypass the security check of setAccessible(true), since this
@ -1354,7 +1347,7 @@ public class Proxy implements Serializable
m.flag = true;
Object[] args = {loader, qualName, bytecode, new Integer(0),
new Integer(bytecode.length),
/* Object.class.getProtectionDomain() */ };
Object.class.getProtectionDomain() };
Class clazz = (Class) m.invoke(null, args);
m.flag = false;