StackWalker.StackFrame (Java SE 13 & JDK 13 )
- Enclosing class:
- StackWalker
public static interface StackWalker.StackFrame
- See Java Virtual Machine Specification:
-
2.6
- Since:
- 9
-
Method Summary
Modifier and Type Method Description intgetByteCodeIndex()Returns the index to the code array of the
Codeattribute containing the execution point represented by this stack frame.StringgetClassName()Gets the binary name of the declaring class of the method represented by this stack frame.
Class<?>getDeclaringClass()Gets the declaring
Classfor the method represented by this stack frame.default StringgetDescriptor()Returns the descriptor of the method represented by this stack frame as defined by The Java Virtual Machine Specification.
StringgetFileName()Returns the name of the source file containing the execution point represented by this stack frame.
intgetLineNumber()Returns the line number of the source line containing the execution point represented by this stack frame.
StringgetMethodName()Gets the name of the method represented by this stack frame.
default MethodTypegetMethodType()Returns the
MethodTyperepresenting the parameter types and the return type for the method represented by this stack frame.booleanisNativeMethod()Returns
trueif the method containing the execution point represented by this stack frame is a native method.StackTraceElementtoStackTraceElement()Gets a
StackTraceElementfor this stack frame.
-
Method Details
-
getClassName
Gets the binary name of the declaring class of the method represented by this stack frame.
- Returns:
- the binary name of the declaring class of the method represented by this stack frame
- See Java Language Specification:
-
13.1 The Form of a Binary
-
getMethodName
Gets the name of the method represented by this stack frame.
- Returns:
- the name of the method represented by this stack frame
-
getDeclaringClass
Class<?> getDeclaringClass()
Gets the declaring
Classfor the method represented by this stack frame.- Returns:
- the declaring
Classof the method represented by this stack frame - Throws:
UnsupportedOperationException- if thisStackWalkeris not configured withOption.RETAIN_CLASS_REFERENCE.
-
getMethodType
Returns the
MethodTyperepresenting the parameter types and the return type for the method represented by this stack frame.- Implementation Requirements:
- The default implementation throws
UnsupportedOperationException. - Returns:
- the
MethodTypefor this stack frame - Throws:
UnsupportedOperationException- if thisStackWalkeris not configured withOption.RETAIN_CLASS_REFERENCE.- Since:
- 10
-
getDescriptor
default String getDescriptor()
Returns the descriptor of the method represented by this stack frame as defined by The Java Virtual Machine Specification.
- Implementation Requirements:
- The default implementation throws
UnsupportedOperationException. - Returns:
- the descriptor of the method represented by this stack frame
- See Java Virtual Machine Specification:
-
4.3.3 Method Descriptor
- Since:
- 10
- See Also:
MethodType.fromMethodDescriptorString(String, ClassLoader),MethodType.toMethodDescriptorString()
-
getByteCodeIndex
int getByteCodeIndex()
Returns the index to the code array of the
Codeattribute containing the execution point represented by this stack frame. The code array gives the actual bytes of Java Virtual Machine code that implement the method.- Returns:
- the index to the code array of the
Codeattribute containing the execution point represented by this stack frame, or a negative number if the method is native. - See Java Virtual Machine Specification:
-
4.7.3 The
CodeAttribute
-
getFileName
Returns the name of the source file containing the execution point represented by this stack frame. Generally, this corresponds to the
SourceFileattribute of the relevantclassfile as defined by The Java Virtual Machine Specification. In some systems, the name may refer to some source code unit other than a file, such as an entry in a source repository.- Returns:
- the name of the file containing the execution point
represented by this stack frame, or
nullif this information is unavailable. - See Java Virtual Machine Specification:
-
4.7.10 The
SourceFileAttribute
-
getLineNumber
int getLineNumber()
Returns the line number of the source line containing the execution point represented by this stack frame. Generally, this is derived from the
LineNumberTableattribute of the relevantclassfile as defined by The Java Virtual Machine Specification.- Returns:
- the line number of the source line containing the execution point represented by this stack frame, or a negative number if this information is unavailable.
- See Java Virtual Machine Specification:
-
4.7.12 The
LineNumberTableAttribute
-
isNativeMethod
boolean isNativeMethod()
Returns
trueif the method containing the execution point represented by this stack frame is a native method.- Returns:
trueif the method containing the execution point represented by this stack frame is a native method.
-
toStackTraceElement
Gets a
StackTraceElementfor this stack frame.- Returns:
StackTraceElementfor this stack frame.
-
Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2019, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.