[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: currentClassLoader problem
From: |
Andrew Haley |
Subject: |
RE: currentClassLoader problem |
Date: |
Tue, 16 Mar 2004 14:35:05 +0000 |
David Holmes writes:
> Andrew,
>
> I just realized that this code isn't in the Classpath version at all.
You would not expect it to be, would you? VMSecurityManager is part
of the VM-specific layer. It's a good deal more helpful than
static native ClassLoader currentClassLoader();
Andrew.
>
> David
>
> > Index: java/lang/VMSecurityManager.java
> > ===================================================================
> > RCS file: /cvs/gcc/gcc/libjava/java/lang/VMSecurityManager.java,v
> > retrieving revision 1.2
> > diff -c -2 -p -r1.2 VMSecurityManager.java
> > *** java/lang/VMSecurityManager.java 5 Dec 2002 00:49:29 -0000
> > 1.2
> > --- java/lang/VMSecurityManager.java 15 Mar 2004 09:54:54 -0000
> > *************** class VMSecurityManager
> > *** 55,63 ****
> > // FIXME this implementation is a bit wrong too -- the docs say we
> > // must also consider ancestors of the system class loader.
> > Class[] classStack = getClassContext ();
> > for (int i = 0; i < classStack.length; i++)
> > {
> > ClassLoader loader = classStack[i].getClassLoader();
> > ! if (loader != null)
> > return loader;
> > }
> > --- 55,64 ----
> > // FIXME this implementation is a bit wrong too -- the docs say we
> > // must also consider ancestors of the system class loader.
> > + ClassLoader systemClassLoader =
> > VMClassLoader.getSystemClassLoader();
> > Class[] classStack = getClassContext ();
> > for (int i = 0; i < classStack.length; i++)
> > {
> > ClassLoader loader = classStack[i].getClassLoader();
> > ! if (loader != null && loader != systemClassLoader)
> > return loader;
> > }
> >