< prev index next >

## src/java.base/share/classes/java/lang/StackTraceElement.java

Print this page

     43  * Throwable#getStackTrace()}.  Each element represents a single stack frame.
     44  * All stack frames except for the one at the top of the stack represent
     45  * a method invocation.  The frame at the top of the stack represents the
     46  * execution point at which the stack trace was generated.  Typically,
     47  * this is the point at which the throwable corresponding to the stack trace
     48  * was created.
     49  *
     50  * @since  1.4
     51  * @author Josh Bloch
     52  */
     53 public final class StackTraceElement implements java.io.Serializable {
     54
     55     // For Throwables and StackWalker, the VM initially sets this field to a
     56     // reference to the declaring Class.  The Class reference is used to
     57     // construct the 'format' bitmap, and then is cleared.
     58     //
     59     // For STEs constructed using the public constructors, this field is not used.
     60     private transient Class<?> declaringClassObject;
     61
     62     // Normally initialized by VM

     63     private String classLoaderName;

     64     private String moduleName;

     65     private String moduleVersion;

     66     private String declaringClass;

     67     private String methodName;

     68     private String fileName;

     69     private int    lineNumber;

     70     private byte   format = 0; // Default to show all
     71
     72     /**
     73      * Creates a stack trace element representing the specified execution
     74      * point. The {@link #getModuleName module name} and {@link
     75      * #getModuleVersion module version} of the stack trace element will
     76      * be {@code null}.
     77      *
     78      * @param declaringClass the fully qualified name of the class containing
     79      *        the execution point represented by the stack trace element
     80      * @param methodName the name of the method containing the execution point
     81      *        represented by the stack trace element
     82      * @param fileName the name of the file containing the execution point
     83      *         represented by the stack trace element, or {@code null} if
     84      *         this information is unavailable
     85      * @param lineNumber the line number of the source line containing the
     86      *         execution point represented by this stack trace element, or
     87      *         a negative number if this information is unavailable. A value
     88      *         of -2 indicates that the method containing the execution point
     89      *         is a native method
     43  * Throwable#getStackTrace()}.  Each element represents a single stack frame.
     44  * All stack frames except for the one at the top of the stack represent
     45  * a method invocation.  The frame at the top of the stack represents the
     46  * execution point at which the stack trace was generated.  Typically,
     47  * this is the point at which the throwable corresponding to the stack trace
     48  * was created.
     49  *
     50  * @since  1.4
     51  * @author Josh Bloch
     52  */
     53 public final class StackTraceElement implements java.io.Serializable {
     54
     55     // For Throwables and StackWalker, the VM initially sets this field to a
     56     // reference to the declaring Class.  The Class reference is used to
     57     // construct the 'format' bitmap, and then is cleared.
     58     //
     59     // For STEs constructed using the public constructors, this field is not used.
     60     private transient Class<?> declaringClassObject;
     61
     62     // Normally initialized by VM
     63     /**
     64      * The name of the class loader.
     65      */
     66     private String classLoaderName;
     67     /**
     68      * The module name.
     69      */
     70     private String moduleName;
     71     /**
     72      * The module version.
     73      */
     74     private String moduleVersion;
     75     /**
     76      * The declaring class.
     77      */
     78     private String declaringClass;
     79     /**
     80      * The method name.
     81      */
     82     private String methodName;
     83     /**
     84      * The source file name.
     85      */
     86     private String fileName;
     87     /**
     88      * The source line number.
     89      */
     90     private int    lineNumber;
     91     /**
     92      * Control to show full or partial module, package, and class names.
     93      */
     94     private byte   format = 0; // Default to show all
     95
     96     /**
     97      * Creates a stack trace element representing the specified execution
     98      * point. The {@link #getModuleName module name} and {@link
     99      * #getModuleVersion module version} of the stack trace element will
    100      * be {@code null}.
    101      *
    102      * @param declaringClass the fully qualified name of the class containing
    103      *        the execution point represented by the stack trace element
    104      * @param methodName the name of the method containing the execution point
    105      *        represented by the stack trace element
    106      * @param fileName the name of the file containing the execution point
    107      *         represented by the stack trace element, or {@code null} if
    108      *         this information is unavailable
    109      * @param lineNumber the line number of the source line containing the
    110      *         execution point represented by this stack trace element, or
    111      *         a negative number if this information is unavailable. A value
    112      *         of -2 indicates that the method containing the execution point
    113      *         is a native method

< prev index next >