StackWalker.StackFrame (Java SE 9 & JDK 9 ) (original) (raw)
- Enclosing class:
StackWalker
public static interface StackWalker.StackFrame
Since:
9
See The Java™ Virtual Machine Specification:
2.6
Method Summary
All Methods Instance Methods Abstract Methods
Modifier and Type Method Description int getByteCodeIndex() Returns the index to the code array of the Code attribute containing the execution point represented by this stack frame. String getClassName() Gets the binary name of the declaring class of the method represented by this stack frame. Class<?> getDeclaringClass() Gets the declaring Class for the method represented by this stack frame. String getFileName() Returns the name of the source file containing the execution point represented by this stack frame. int getLineNumber() Returns the line number of the source line containing the execution point represented by this stack frame. String getMethodName() Gets the name of the method represented by this stack frame. boolean isNativeMethod() Returns true if the method containing the execution point represented by this stack frame is a native method. StackTraceElement toStackTraceElement() Gets a StackTraceElement for this stack frame. Method Detail
* #### getClassName [String](../../java/lang/String.html "class in java.lang") getClassName() Gets the [binary name](ClassLoader.html#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 The Java™ Language Specification: 13.1 The Form of a Binary * #### getMethodName [String](../../java/lang/String.html "class in java.lang") 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](../../java/lang/Class.html "class in java.lang")<?> getDeclaringClass() Gets the declaring `Class` for the method represented by this stack frame. Returns: the declaring `Class` of the method represented by this stack frame Throws: `[UnsupportedOperationException](../../java/lang/UnsupportedOperationException.html "class in java.lang")` \- if this `StackWalker` is not configured with [Option.RETAIN\_CLASS\_REFERENCE](../../java/lang/StackWalker.Option.html#RETAIN%5FCLASS%5FREFERENCE). * #### getByteCodeIndex int getByteCodeIndex() Returns the index to the code array of the `Code` attribute 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 `Code` attribute containing the execution point represented by this stack frame, or a negative number if the method is native. See The Java™ Virtual Machine Specification: 4.7.3 The `Code` Attribute * #### getFileName [String](../../java/lang/String.html "class in java.lang") getFileName() Returns the name of the source file containing the execution point represented by this stack frame. Generally, this corresponds to the `SourceFile` attribute of the relevant `class` file 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 `null` if this information is unavailable. See The Java™ Virtual Machine Specification: 4.7.10 The `SourceFile` Attribute * #### 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 `LineNumberTable` attribute of the relevant`class` file 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 The Java™ Virtual Machine Specification: 4.7.12 The `LineNumberTable` Attribute * #### isNativeMethod boolean isNativeMethod() Returns `true` if the method containing the execution point represented by this stack frame is a native method. Returns: `true` if the method containing the execution point represented by this stack frame is a native method. * #### toStackTraceElement [StackTraceElement](../../java/lang/StackTraceElement.html "class in java.lang") toStackTraceElement() Gets a `StackTraceElement` for this stack frame. Returns: `StackTraceElement` for 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, 2017, 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.