Index: /luni-kernel/src/main/java/java/lang/StackTraceElement.java =================================================================== --- /luni-kernel/src/main/java/java/lang/StackTraceElement.java (revision 390753) +++ /luni-kernel/src/main/java/java/lang/StackTraceElement.java (working copy) @@ -18,7 +18,7 @@ /** * An implementation of this class is provided, but the documented constructor - * can be used by the vm specific implementation to create instances. + * can be used by the VM specific implementation to create instances. * * StackTraceElement represents a stack frame. * @@ -23,6 +23,7 @@ * StackTraceElement represents a stack frame. * * @see Throwable#getStackTrace() + * @since 1.4 */ public final class StackTraceElement implements java.io.Serializable { private static final long serialVersionUID = 6992337162326171013L; @@ -32,18 +33,24 @@ int lineNumber; /** - * Create a StackTraceElement from the parameters. - * - * @param cls - * The class name - * @param method - * The method name - * @param file - * The file name - * @param line - * The line number - */ - StackTraceElement(String cls, String method, String file, int line) { + *
+ * Constructs a StackTraceElement for an execution point.
+ *
null.
+ * @param line The line of the file where execution is at, a negative number
+ * if unknown or -2 if the execution is in a native
+ * method.
+ *
+ * @throws NullPointerException if cls or method
+ * is null.
+ *
+ * @since 1.5
+ */
+ public StackTraceElement(String cls, String method, String file, int line) {
if (cls == null || method == null)
throw new NullPointerException();
declaringClass = cls;
@@ -52,7 +59,11 @@
lineNumber = line;
}
- // prevent instantiation from java code - only the VM creates these
+ /**
+ * + * Private, nullary constructor for VM use only. + *
+ */ private StackTraceElement() { // Empty } @@ -107,7 +118,7 @@ * is executing. * * @return if available, the name of the file containing the Java code - * source for the stack trace element's excuting class. If no such + * source for the stack trace element's executing class. If no such * detail is available, anull value is returned.
*/
public String getFileName() {
@@ -168,7 +179,7 @@
* @see java.lang.Object#toString()
*/
public String toString() {
- StringBuffer buf = new StringBuffer(80);
+ StringBuilder buf = new StringBuilder(80);
buf.append(getClassName());
buf.append('.');