jdk/src/java.base/share/classes/java/lang/StackTraceElement.java
author chegar
Sun, 17 Aug 2014 15:54:13 +0100
changeset 25859 3317bb8137f4
parent 23010 jdk/src/share/classes/java/lang/StackTraceElement.java@6dadb192ad81
child 36511 9d0388c6b336
child 37313 b0c043d9ad18
permissions -rw-r--r--
8054834: Modular Source Code Reviewed-by: alanb, chegar, ihse, mduigou Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, chris.hegarty@oracle.com, erik.joelsson@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, magnus.ihse.bursie@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, paul.sandoz@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
23010
6dadb192ad81 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents: 18156
diff changeset
     2
 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.lang;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
7186
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
    28
import java.util.Objects;
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
    29
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * An element in a stack trace, as returned by {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * Throwable#getStackTrace()}.  Each element represents a single stack frame.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * All stack frames except for the one at the top of the stack represent
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * a method invocation.  The frame at the top of the stack represents the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * execution point at which the stack trace was generated.  Typically,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * this is the point at which the throwable corresponding to the stack trace
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * was created.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * @since  1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * @author Josh Bloch
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
public final class StackTraceElement implements java.io.Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
    // Normally initialized by VM (public constructor added in 1.5)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    private String declaringClass;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    private String methodName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    private String fileName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    private int    lineNumber;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
     * Creates a stack trace element representing the specified execution
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
     * point.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     * @param declaringClass the fully qualified name of the class containing
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     *        the execution point represented by the stack trace element
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     * @param methodName the name of the method containing the execution point
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     *        represented by the stack trace element
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * @param fileName the name of the file containing the execution point
7186
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
    58
     *         represented by the stack trace element, or {@code null} if
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     *         this information is unavailable
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * @param lineNumber the line number of the source line containing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     *         execution point represented by this stack trace element, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     *         a negative number if this information is unavailable. A value
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     *         of -2 indicates that the method containing the execution point
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     *         is a native method
7186
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
    65
     * @throws NullPointerException if {@code declaringClass} or
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
    66
     *         {@code methodName} is null
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    public StackTraceElement(String declaringClass, String methodName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
                             String fileName, int lineNumber) {
8166
13423c0952ad 7012540: java.util.Objects.nonNull() incorrectly named
briangoetz
parents: 7186
diff changeset
    71
        this.declaringClass = Objects.requireNonNull(declaringClass, "Declaring class is null");
13423c0952ad 7012540: java.util.Objects.nonNull() incorrectly named
briangoetz
parents: 7186
diff changeset
    72
        this.methodName     = Objects.requireNonNull(methodName, "Method name is null");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        this.fileName       = fileName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        this.lineNumber     = lineNumber;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * Returns the name of the source file containing the execution point
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * represented by this stack trace element.  Generally, this corresponds
7186
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
    80
     * to the {@code SourceFile} attribute of the relevant {@code class}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * file (as per <i>The Java Virtual Machine Specification</i>, Section
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * 4.7.7).  In some systems, the name may refer to some source code unit
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * other than a file, such as an entry in source repository.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * @return the name of the file containing the execution point
7186
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
    86
     *         represented by this stack trace element, or {@code null} if
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     *         this information is unavailable.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    public String getFileName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        return fileName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * Returns the line number of the source line containing the execution
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * point represented by this stack trace element.  Generally, this is
7186
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
    96
     * derived from the {@code LineNumberTable} attribute of the relevant
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
    97
     * {@code class} file (as per <i>The Java Virtual Machine
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * Specification</i>, Section 4.7.8).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * @return the line number of the source line containing the execution
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     *         point represented by this stack trace element, or a negative
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     *         number if this information is unavailable.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    public int getLineNumber() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        return lineNumber;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * Returns the fully qualified name of the class containing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * execution point represented by this stack trace element.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     *
7186
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
   112
     * @return the fully qualified name of the {@code Class} containing
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     *         the execution point represented by this stack trace element.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    public String getClassName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        return declaringClass;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * Returns the name of the method containing the execution point
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * represented by this stack trace element.  If the execution point is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * contained in an instance or class initializer, this method will return
7186
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
   123
     * the appropriate <i>special method name</i>, {@code <init>} or
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
   124
     * {@code <clinit>}, as per Section 3.9 of <i>The Java Virtual
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * Machine Specification</i>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * @return the name of the method containing the execution point
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     *         represented by this stack trace element.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    public String getMethodName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        return methodName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * Returns true if the method containing the execution point
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * represented by this stack trace element is a native method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     *
7186
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
   138
     * @return {@code true} if the method containing the execution point
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     *         represented by this stack trace element is a native method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    public boolean isNativeMethod() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        return lineNumber == -2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * Returns a string representation of this stack trace element.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * format of this string depends on the implementation, but the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * examples may be regarded as typical:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * <li>
7186
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
   151
     *   {@code "MyClass.mash(MyClass.java:9)"} - Here, {@code "MyClass"}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     *   is the <i>fully-qualified name</i> of the class containing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     *   execution point represented by this stack trace element,
7186
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
   154
     *   {@code "mash"} is the name of the method containing the execution
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
   155
     *   point, {@code "MyClass.java"} is the source file containing the
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
   156
     *   execution point, and {@code "9"} is the line number of the source
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     *   line containing the execution point.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * <li>
7186
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
   159
     *   {@code "MyClass.mash(MyClass.java)"} - As above, but the line
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     *   number is unavailable.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * <li>
7186
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
   162
     *   {@code "MyClass.mash(Unknown Source)"} - As above, but neither
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     *   the file name nor the line  number are available.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * <li>
7186
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
   165
     *   {@code "MyClass.mash(Native Method)"} - As above, but neither
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     *   the file name nor the line  number are available, and the method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     *   containing the execution point is known to be a native method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * @see    Throwable#printStackTrace()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        return getClassName() + "." + methodName +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
            (isNativeMethod() ? "(Native Method)" :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
             (fileName != null && lineNumber >= 0 ?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
              "(" + fileName + ":" + lineNumber + ")" :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
              (fileName != null ?  "("+fileName+")" : "(Unknown Source)")));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * Returns true if the specified object is another
7186
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
   181
     * {@code StackTraceElement} instance representing the same execution
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
   182
     * point as this instance.  Two stack trace elements {@code a} and
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
   183
     * {@code b} are equal if and only if:
18156
edb590d448c5 8016217: More javadoc warnings
alanb
parents: 9035
diff changeset
   184
     * <pre>{@code
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     *     equals(a.getFileName(), b.getFileName()) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     *     a.getLineNumber() == b.getLineNumber()) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     *     equals(a.getClassName(), b.getClassName()) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     *     equals(a.getMethodName(), b.getMethodName())
18156
edb590d448c5 8016217: More javadoc warnings
alanb
parents: 9035
diff changeset
   189
     * }</pre>
7186
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
   190
     * where {@code equals} has the semantics of {@link
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
   191
     * java.util.Objects#equals(Object, Object) Objects.equals}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * @param  obj the object to be compared with this stack trace element.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * @return true if the specified object is another
7186
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
   195
     *         {@code StackTraceElement} instance representing the same
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     *         execution point as this instance.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    public boolean equals(Object obj) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        if (obj==this)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        if (!(obj instanceof StackTraceElement))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        StackTraceElement e = (StackTraceElement)obj;
7186
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
   204
        return e.declaringClass.equals(declaringClass) &&
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
   205
            e.lineNumber == lineNumber &&
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
   206
            Objects.equals(methodName, e.methodName) &&
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
   207
            Objects.equals(fileName, e.fileName);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * Returns a hash code value for this stack trace element.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    public int hashCode() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        int result = 31*declaringClass.hashCode() + methodName.hashCode();
7186
7f5fe8985263 6991528: Support making Throwable.suppressedExceptions immutable
darcy
parents: 5506
diff changeset
   215
        result = 31*result + Objects.hashCode(fileName);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        result = 31*result + lineNumber;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        return result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    private static final long serialVersionUID = 6992337162326171013L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
}