This is used to support the this.caller magic reference and to print script "stack traces" when evaluation errors occur.
Note
it would be awefully nice to use the java.util.Stack here. Sigh... have to stay 1.1 compatible.
Note
How can this be thread safe, you might ask? Wouldn't a thread executing various beanshell methods be mutating the callstack? Don't we need one CallStack per Thread in the interpreter? The answer is that we do. Any java.lang.Thread enters our script via an external (hard) Java reference via a This type interface, e.g. the Runnable interface implemented by This or an arbitrary interface implemented by XThis. In that case the This invokeMethod() method (called by any interface that it exposes) creates a new CallStack for each external call.
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public CallStack | |
| public int | |
| public NameSpace | |
| public NameSpace | |
| public void | |
| public void | |
| public NameSpace | |
| public NameSpace[] | |
| public NameSpace | |
| public String |
| stack | back to summary |
|---|---|
| private Vector<E> stack | |
| CallStack | back to summary |
|---|---|
| public CallStack() | |
| CallStack | back to summary |
|---|---|
| public CallStack(NameSpace namespace) | |
| clear | back to summary |
|---|---|
| public void clear() | |
| copy | back to summary |
|---|---|
| public CallStack copy() Occasionally we need to freeze the callstack for error reporting purposes, etc. | |
| depth | back to summary |
|---|---|
| public int depth() | |
| get | back to summary |
|---|---|
| public NameSpace get(int depth) zero based. | |
| pop | back to summary |
|---|---|
| public NameSpace pop() | |
| push | back to summary |
|---|---|
| public void push(NameSpace ns) | |
| set | back to summary |
|---|---|
| public void set(int depth, NameSpace ns) This is kind of crazy, but used by the setNameSpace command. zero based. | |
| swap | back to summary |
|---|---|
| public NameSpace swap(NameSpace newTop) Swap in the value as the new top of the stack and return the old value. | |
| toArray | back to summary |
|---|---|
| public NameSpace[] toArray() | |
| top | back to summary |
|---|---|
| public NameSpace top() | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
| |