Jochen Hoenicke wrote:
>
> I'm currently using gnu.vm.stack.StackTrace in
> java.util.ResourceBundle, to get the ClassLoader of the calling method
> (which might be the system class loader). SUN JDK uses a native
> method getClassContext() for this.
>
> Some suggestion how this should be solved? I think
> VMSecurityManager.getClassContext() does what I need, but it is not
> accessible. (I could extend SecurityManager in an inner class, to use
> getClassContext, but this isn't nice.)
One way would to use a native method to call into VMSecurityManager, as
native methods aren't access-checked (I believe). This is nice-ish
because it doesn't open any "security holes" that aren't there already
(which any pure-java technique would have to).
Stuart.