View Javadoc

1   // Throwable.java, created Thu Jul  4  4:50:03 2002 by joewhaley
2   // Copyright (C) 2001-3 John Whaley <jwhaley@alum.mit.edu>
3   // Licensed under the terms of the GNU LGPL; see COPYING for details.
4   package joeq.ClassLib.Common.java.lang;
5   
6   import joeq.Runtime.ExceptionDeliverer;
7   import jwutil.util.Assert;
8   
9   /***
10   * Throwable
11   *
12   * @author  John Whaley <jwhaley@alum.mit.edu>
13   * @version $Id: Throwable.java 1941 2004-09-30 03:37:06Z joewhaley $
14   */
15  public abstract class Throwable {
16      
17      private java.lang.Object backtrace;
18      
19      // native method implementations
20      private void printStackTrace0(java.lang.Object s) {
21          java.lang.Object backtrace = this.backtrace;
22          if (s instanceof java.io.PrintWriter)
23              ExceptionDeliverer.printStackTrace(backtrace, (java.io.PrintWriter)s);
24          else if (s instanceof java.io.PrintStream)
25              ExceptionDeliverer.printStackTrace(backtrace, (java.io.PrintStream)s);
26          else
27              Assert.UNREACHABLE();
28      }
29      
30      public java.lang.Throwable fillInStackTrace() {
31          this.backtrace = ExceptionDeliverer.getStackTrace();
32          java.lang.Object o = this;
33          return (java.lang.Throwable)o;
34      }
35  
36      public java.lang.Object getBacktraceObject() { return this.backtrace; }
37  }