public class CallStack extends Object
public class Blah {
public m2() {
System.out.println(new CallStack()); // (1)
System.out.println(CallStack.here()); // (2)
}
public m1() {
m2();
}
public static void main(String[] args) {
m1();
}
}
-->
Blah.main(12)->Blah.m1(8)->Blah.m2(2) // Call Stack at (1)
Blah.m2(3) // Method and line number at (2)
| Modifier and Type | Field and Description |
|---|---|
protected Stack<StackTraceElement> |
callstack
Holds the call stack
|
| Constructor and Description |
|---|
CallStack()
Constructs a call stack from the current program position (without the constructor call)
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o)
Returns TRUE if the two call stacks have the same elements
|
Stack<StackTraceElement> |
getCallstack()
Returns the callstack
|
static StackTraceElement |
here()
Gives the calling position
|
static void |
main(String[] args)
Test routine
|
CallStack |
ret()
Pops the top level of this callstack, returns this callstack
|
StackTraceElement |
top()
Gives the calling position as a StackTraceElement
|
String |
toString()
Returns "method(line)->method(line)->..."
|
static String |
toString(StackTraceElement e)
Returns a nice String for a Stacktraceelement
|
protected Stack<StackTraceElement> callstack
public CallStack()
public boolean equals(Object o)
public static String toString(StackTraceElement e)
public String toString()
public StackTraceElement top()
public static StackTraceElement here()
public Stack<StackTraceElement> getCallstack()
public CallStack ret()
public static void main(String[] args)
Copyright © 2018. All rights reserved.