Throwable#getStackTrace()
. Each element represents a single stack frame.
All stack frames except for the one at the top of the stack represent
a method invocation. The frame at the top of the stack represents the
execution point at which the stack trace was generated. Typically,
this is the point at which the throwable corresponding to the stack trace
was created.
Modifier and Type | Class and Description |
---|---|
private static class |
Modifier and Type | Field and Description |
---|---|
private static final byte | |
private String | classLoaderName
The name of the class loader. |
private String | declaringClass
The declaring class. |
private transient Class | |
private String | fileName
The source file name. |
private byte | format
Control to show full or partial module, package, and class names. |
private static final byte | |
private int | lineNumber
The source line number. |
private String | methodName
The method name. |
private String | moduleName
The module name. |
private String | moduleVersion
The module version. |
private static final String | |
private static final long | |
private static final String |
Access | Constructor and Description |
---|---|
public | StackTraceElement(String
the binary name
of the class containing the execution point represented by
the stack trace element declaringClass, String the name of the method containing the execution point
represented by the stack trace element methodName, String the name of the file containing the execution point
represented by the stack trace element, or fileName, int null if
this information is unavailablethe line number of the source line containing the
execution point represented by this stack trace element, or
a negative number if this information is unavailable. A value
of -2 indicates that the method containing the execution point
is a native method lineNumber)Creates a stack trace element representing the specified execution point. |
public | StackTraceElement(String
the class loader name if the class loader of
the class containing the execution point represented by
the stack trace is named; otherwise classLoaderName, String null the module name if the class containing the
execution point represented by the stack trace is in a named
module; otherwise moduleName, String null the module version if the class containing the
execution point represented by the stack trace is in a named
module that has a version; otherwise moduleVersion, String null the binary name
of the class containing the execution point represented by
the stack trace element declaringClass, String the name of the method containing the execution point
represented by the stack trace element methodName, String the name of the file containing the execution point
represented by the stack trace element, or fileName, int null if
this information is unavailablethe line number of the source line containing the
execution point represented by this stack trace element, or
a negative number if this information is unavailable. A value
of -2 indicates that the method containing the execution point
is a native method lineNumber)Creates a stack trace element representing the specified execution point. |
private |
Modifier and Type | Method and Description |
---|---|
private synchronized void | computeFormat()
Called from of() methods to set the 'format' bitmap using the Class reference stored in declaringClassObject, and then clear the reference. |
private boolean | |
private boolean | |
public boolean | Returns: true if the specified object is anotherStackTraceElement instance representing the same
execution point as this instance.the object to be compared with this stack trace element. obj)Overrides java. Returns true if the specified object is another
|
public String | Returns: the name of the class loader of the class containing the execution point represented by this stack trace element;null
if the class loader is not named.Returns the name of the class loader of the class containing the execution point represented by this stack trace element. |
public String | Returns: the binary name of theClass containing the execution point represented
by this stack trace elementReturns the binary name
of the |
public String | Returns: the name of the file containing the execution point represented by this stack trace element, ornull if
this information is unavailable.Returns the name of the source file containing the execution point represented by this stack trace element. |
public int | Returns: the line number of the source line containing the execution point represented by this stack trace element, or a negative number if this information is unavailable.Returns the line number of the source line containing the execution point represented by this stack trace element. |
public String | Returns: the name of the method containing the execution point represented by this stack trace element.Returns the name of the method containing the execution point represented by this stack trace element. |
public String | Returns: the module name of theModule containing the execution
point represented by this stack trace element; null
if the module name is not available.Returns the module name of the module containing the execution point represented by this stack trace element. |
public String | Returns: the module version of theModule containing the execution
point represented by this stack trace element; null
if the module version is not available.Returns the module version of the module containing the execution point represented by this stack trace element. |
public int | hashCode()
Overrides java. Returns a hash code value for this stack trace element. |
private static native void | |
private static native void | |
private static boolean | |
public boolean | Returns: true if the method containing the execution point
represented by this stack trace element is a native method.Returns true if the method containing the execution point represented by this stack trace element is a native method. |
private static int | |
pack-priv static StackTraceElement[] | |
pack-priv static StackTraceElement | |
pack-priv static StackTraceElement[] | |
public String | toString()
Overrides java. Returns a string representation of this stack trace element. |
BUILTIN_CLASS_LOADER | back to summary |
---|---|
private static final byte BUILTIN_CLASS_LOADER |
classLoaderName | back to summary |
---|---|
private String classLoaderName The name of the class loader. |
declaringClass | back to summary |
---|---|
private String declaringClass The declaring class. |
declaringClassObject | back to summary |
---|---|
private transient Class<?> declaringClassObject |
fileName | back to summary |
---|---|
private String fileName The source file name. |
format | back to summary |
---|---|
private byte format Control to show full or partial module, package, and class names. |
JDK_NON_UPGRADEABLE_MODULE | back to summary |
---|---|
private static final byte JDK_NON_UPGRADEABLE_MODULE |
lineNumber | back to summary |
---|---|
private int lineNumber The source line number. |
methodName | back to summary |
---|---|
private String methodName The method name. |
moduleName | back to summary |
---|---|
private String moduleName The module name. |
moduleVersion | back to summary |
---|---|
private String moduleVersion The module version. |
NATIVE_METHOD | back to summary |
---|---|
private static final String NATIVE_METHOD |
serialVersionUID | back to summary |
---|---|
private static final long serialVersionUID
|
UNKNOWN_SOURCE | back to summary |
---|---|
private static final String UNKNOWN_SOURCE |
StackTraceElement | back to summary |
---|---|
public StackTraceElement(String declaringClass, String methodName, String fileName, int lineNumber) Creates a stack trace element representing the specified execution
point. The
|
StackTraceElement | back to summary |
---|---|
public StackTraceElement(String classLoaderName, String moduleName, String moduleVersion, String declaringClass, String methodName, String fileName, int lineNumber) Creates a stack trace element representing the specified execution point.
|
StackTraceElement | back to summary |
---|---|
private StackTraceElement() |
computeFormat | back to summary |
---|---|
private synchronized void computeFormat() Called from of() methods to set the 'format' bitmap using the Class reference stored in declaringClassObject, and then clear the reference. If the module is a non-upgradeable JDK module, then set JDK_NON_UPGRADEABLE_MODULE to omit its version string.
If the loader is one of the built-in loaders (`boot`, `platform`, or `app`)
then set BUILTIN_CLASS_LOADER to omit the first element (` |
dropClassLoaderName | back to summary |
---|---|
private boolean dropClassLoaderName() |
dropModuleVersion | back to summary |
---|---|
private boolean dropModuleVersion() |
equals | back to summary |
---|---|
public boolean equals(Object obj) Overrides java. Returns true if the specified object is another
where equals has the semantics of Objects. .
|
getClassLoaderName | back to summary |
---|---|
public String getClassLoaderName() Returns the name of the class loader of the class containing the execution point represented by this stack trace element.
|
getClassName | back to summary |
---|---|
public String getClassName() Returns the binary name
of the
|
getFileName | back to summary |
---|---|
public String getFileName() Returns the name of the source file containing the execution point
represented by this stack trace element. Generally, this corresponds
to the
|
getLineNumber | back to summary |
---|---|
public int getLineNumber() Returns the line number of the source line containing the execution
point represented by this stack trace element. Generally, this is
derived from the
|
getMethodName | back to summary |
---|---|
public String getMethodName() Returns the name of the method containing the execution point represented by this stack trace element. If the execution point is contained in an instance or class initializer, this method will return the appropriate special method name, <init> or <clinit>, as per Section 3.9 of The Java Virtual Machine Specification.
|
getModuleName | back to summary |
---|---|
public String getModuleName() Returns the module name of the module containing the execution point represented by this stack trace element.
|
getModuleVersion | back to summary |
---|---|
public String getModuleVersion() Returns the module version of the module containing the execution point represented by this stack trace element.
|
hashCode | back to summary |
---|---|
public int hashCode() Overrides java. Returns a hash code value for this stack trace element.
|
initStackTraceElement | back to summary |
---|---|
private static native void initStackTraceElement(StackTraceElement element, StackFrameInfo sfi) |
initStackTraceElements | back to summary |
---|---|
private static native void initStackTraceElements(StackTraceElement[] elements, Object x, int depth) |
isHashedInJavaBase | back to summary |
---|---|
private static boolean isHashedInJavaBase(Module m) Returns true if the module is hashed with java.base.
This method returns false when running on the exploded image
since JDK modules are not hashed. They have no Version attribute
and so "@ |
isNativeMethod | back to summary |
---|---|
public boolean isNativeMethod() Returns true if the method containing the execution point represented by this stack trace element is a native method.
|
length | back to summary |
---|---|
private static int length(String s) |
of | back to summary |
---|---|
pack-priv static StackTraceElement[] of(Object x, int depth) |
of | back to summary |
---|---|
pack-priv static StackTraceElement of(StackFrameInfo sfi) |
of | back to summary |
---|---|
pack-priv static StackTraceElement[] of(StackTraceElement[] stackTrace) |
toString | back to summary |
---|---|
public String toString() Overrides java. Returns a string representation of this stack trace element. API Note The format of this string depends on the implementation, but the following examples may be regarded as typical:
The first example shows a stack trace element consisting of
three elements, each separated by If a class is defined in an unnamed module
then the second element is omitted as shown in
" If the class loader is a
built-in class loader or is not named then the first element
and its following The
|
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
pack-priv static boolean | |
pack-priv static Set |
HASHED_MODULES | back to summary |
---|---|
pack-priv static Set<String> HASHED_MODULES |
HashedModules | back to summary |
---|---|
private HashedModules() |
contains | back to summary |
---|---|
pack-priv static boolean contains(Module m) |
hashedModules | back to summary |
---|---|
pack-priv static Set |