Class PolyglotException.StackFrame

java.lang.Object
org.graalvm.polyglot.PolyglotException.StackFrame
Enclosing class:
PolyglotException

public final class PolyglotException.StackFrame extends Object
Represents a polyglot stack frame originating from a guest language or the host language Java.
Since:
19.0
  • Method Details

    • isHostFrame

      public boolean isHostFrame()
      Returns true if the stack frame originates from the host language. Host frames do not provide a source location. Instead the Java stack frame can be accessed using toHostFrame().
      Since:
      19.0
    • isGuestFrame

      public boolean isGuestFrame()
      Returns true if the stack frame originates from the guest language.
      Since:
      19.0
    • toHostFrame

      public StackTraceElement 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

      public SourceSection getSourceLocation()
      Returns the source location of the stack frame or null 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

      public String 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

      public Language 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

      public String toString()
      Returns a string representation of this stack frame. The format is inspired by the Java stack frame format.
      Overrides:
      toString in class Object
      Since:
      19.0