diff options
author | Jochen Hoenicke <jochen@gnu.org> | 1999-12-30 17:19:39 +0000 |
---|---|---|
committer | Jochen Hoenicke <jochen@gnu.org> | 1999-12-30 17:19:39 +0000 |
commit | 9a2997dac57d594d0ca14455fcc05b36e141ddec (patch) | |
tree | e3f6fc5f54e419ecb197ddce7e7c5ba0155d5b13 /vm | |
parent | c34496ae620cf1bdaa50a29b5701bca0e889779a (diff) | |
download | classpath-9a2997dac57d594d0ca14455fcc05b36e141ddec.tar.gz |
added toString() and getCalledClass()
Diffstat (limited to 'vm')
-rw-r--r-- | vm/reference/gnu/vm/stack/StackFrame.java | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/vm/reference/gnu/vm/stack/StackFrame.java b/vm/reference/gnu/vm/stack/StackFrame.java index abefe087f..7fa4260a4 100644 --- a/vm/reference/gnu/vm/stack/StackFrame.java +++ b/vm/reference/gnu/vm/stack/StackFrame.java @@ -29,13 +29,21 @@ import java.lang.reflect.*; ** @author John Keiser ** @version 1.1.0, Aug 11 1998 **/ -public class StackFrame { +public final class StackFrame { StackFrame caller; Object obj; Method method; int lineNum; String filename; + /** + * Constructs a new stack frame. This is only called by the virtual + * machine. + * @param obj the this reference of that frame, null for static classes. + * @param method the called method. + * @param lineNum the line number or -1 if unknown. + * @param filename the filename of the source of the method, null if unknown. + */ private StackFrame(Object obj, Method method, int lineNum, String filename) { this.caller = caller; this.obj = obj; @@ -52,6 +60,10 @@ public class StackFrame { return obj; } + public Class getCalledClass() { + return method.getDeclaringClass(); + } + public Method getCalledMethod() { return method; } @@ -59,4 +71,13 @@ public class StackFrame { public int getSourceLineNumber() { return lineNum; } + + public String toString() { + return getCalledClass().getName() + "." + + getCalledMethod().getName() + + (getSourceFilename() != null ? + " at " + getSourceFilename() + + ":" + getSourceLineNumber() + : " (compiled code)"); + } } |