classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Asking our experts on class loading: Thanks


From: Meskauskas Audrius
Subject: Re: Asking our experts on class loading: Thanks
Date: Thu, 13 Oct 2005 20:01:06 +0200
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Great., Jeroen.

Jeroen Frijters wrote:

Please add the following method to gnu/classpath/VMStackWalker.java and
use that.

/**
* Returns the first user defined class loader on the call stack, or
* null when no non-null class loader was found.
*/
public static ClassLoader getUserClassLoader()
{
   Class[] ctx = getClassContext();
   for (int i = 0; i < ctx.length; i++)
   {
       // Since we live in a class loaded by the bootstrap
       // class loader, getClassLoader is safe to call without
       // needing to be wrapped in a privileged action.
       ClassLoader cl = ctx[i].getClassLoader();
       if (cl != null)
              return cl;
   }
   return null;
}






reply via email to

[Prev in Thread] Current Thread [Next in Thread]