classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] Patch: FYI: StackTraceElement constructor


From: Tom Tromey
Subject: [cp-patches] Patch: FYI: StackTraceElement constructor
Date: Sat, 26 Nov 2005 15:07:57 -0700

I'm checking this in.

This adds a new StackTraceElement element constructor from 1.5.

Tom

2005-11-26  Tom Tromey  <address@hidden>

        * java/lang/StackTraceElement.java (StackTraceElement): New
        constructor.

Index: java/lang/StackTraceElement.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/lang/StackTraceElement.java,v
retrieving revision 1.7
diff -u -r1.7 StackTraceElement.java
--- java/lang/StackTraceElement.java    2 Jul 2005 20:32:38 -0000       1.7
+++ java/lang/StackTraceElement.java    26 Nov 2005 22:17:31 -0000
@@ -49,7 +49,7 @@
  * @author Mark Wielaard (address@hidden)
  * @author Eric Blake (address@hidden)
  * @since 1.4
- * @status updated to 1.4
+ * @status updated to 1.5
  */
 public final class StackTraceElement implements Serializable
 {
@@ -109,6 +109,26 @@
     this.declaringClass = className;
     this.methodName = methodName;
     this.isNative = isNative;
+  }
+
+  /**
+   * Create a new StackTraceElement representing a given source location.
+   *
+   * @param className the fully qualified name of the class
+   * @param methodName the name of the method
+   * @param fileName the name of the file, null if unknown
+   * @param lineNumber the line in the file, negative if unknown, or -2
+   * if this method is native
+   * 
+   * @since 1.5
+   */
+  public StackTraceElement(String className, String methodName, String 
fileName,
+                           int lineNumber)
+  {
+    this(fileName, lineNumber, className, methodName, lineNumber == -2);
+    // The public constructor doesn't allow certain values to be null.
+    if (className == null || methodName == null)
+      throw new NullPointerException("invalid argument to constructor");
   }
 
   /**





reply via email to

[Prev in Thread] Current Thread [Next in Thread]