Package org.graalvm.polyglot
Class PolyglotException.StackFrame
java.lang.Object
org.graalvm.polyglot.PolyglotException.StackFrame
- Enclosing class:
PolyglotException
Represents a polyglot stack frame originating from a guest language or the host language
Java.
- Since:
- 19.0
-
Method Summary
Modifier and TypeMethodDescriptionint
Returns the bytecode index of this frame if available, or a negative number if no bytecode index is available.Returns the language of this stack frame.Returns the root name of this stack frame.Returns the source location of the stack frame ornull
if no source location is available.boolean
Returns true if the stack frame originates from the guest language.boolean
Returns true if the stack frame originates from the host language.Returns a Java stack trace element representation of the polyglot stack trace element.toString()
Returns a string representation of this stack frame.
-
Method Details
-
isHostFrame
public boolean isHostFrame()Returns true if the stack frame originates from the host language. Host frames do not provide asource location
. Instead the Java stack frame can be accessed usingtoHostFrame()
.- Since:
- 19.0
-
isGuestFrame
public boolean isGuestFrame()Returns true if the stack frame originates from the guest language.- Since:
- 19.0
-
toHostFrame
Returns a Java stack trace element representation of the polyglot stack trace element. This is supported for host stack frames as well as guest language stack frames. A conversion to the host frame format can be useful for interoperability.- Since:
- 19.0
-
getSourceLocation
Returns the source location of the stack frame ornull
if no source location is available. Host frames do never provide a source location.- Since:
- 19.0
-
getBytecodeIndex
public int getBytecodeIndex()Returns the bytecode index of this frame if available, or a negative number if no bytecode index is available. The bytecode index is an internal identifier of the current execution location. The bytecode index is typically only provided by languages that are internally implemented as bytecode interpreter. This information is exposed for debugging or testing purposes and should not be relied upon for anything else.- Since:
- 24.1
-
getRootName
Returns the root name of this stack frame. In case of the host language the Java method name is returned. In guest languages it returns a useful identifier for code. For example, in JavaScript this can be the function name.- Since:
- 19.0
-
getLanguage
Returns the language of this stack frame. In case of the host language a synthetic Java language object is returned.- Since:
- 19.0
-
toString
Returns a string representation of this stack frame. The format is inspired by the Java stack frame format.
-