public final class VMStackWalker extends Object
StackBrowser
class.
This is our interface to GNU Classpath. We quote the official Classpath Javadoc here, as part of clearly describing the interface. Never the less, look at the source code of the GNU Class (classpath/vm/reference/gnu/classpath/VMStackWalker.java) for the latest description of what these methods should do. NOTE: we do not quote any JavaDoc that would cause JavaDoc warnings to be emitted in JDK8.
Constructor and Description |
---|
VMStackWalker() |
Modifier and Type | Method and Description |
---|---|
static ClassLoader |
firstNonNullClassLoader()
Walk up the stack and return the first non-
null class loader. |
static Class<?> |
getCallingClass() |
static Class<?> |
getCallingClass(int skip) |
static ClassLoader |
getCallingClassLoader() |
static Class<?>[] |
getClassContext()
Classpath's Javadoc for this method says:
Get a list of all the classes currently executing methods on the
Java stack.
|
public VMStackWalker()
public static ClassLoader firstNonNullClassLoader()
null
class loader.
If there aren't any non-null
class loaders on the stack, return
null
.null
classloader on stack or null
public static Class<?>[] getClassContext()
Get a list of all the classes currently executing methods on the Java stack.getClassContext()[0]
is the class associated with the currently executing method, i.e., the method that calledVMStackWalker.getClassContext()
(possibly through reflection). So you may need to pop off these stack frames from the top of the stack:
VMStackWalker.getClassContext()
Method.invoke()
public static Class<?> getCallingClass()
public static Class<?> getCallingClass(int skip)
public static ClassLoader getCallingClassLoader()