Module java.base
Package java.lang

Interface StackWalker.StackFrame

  • Enclosing class:
    StackWalker

    public static interface StackWalker.StackFrame
    Contains information about the StackWalker's current stack frame.
    • Method Detail

      • getByteCodeIndex

        int getByteCodeIndex()
        Returns:
        the offset of the current bytecode in the method represented by this frame.
      • getClassName

        String getClassName()
        Returns:
        the binary name of the declaring class of this frame's method.
      • getDeclaringClass

        Class<?> getDeclaringClass()
        Returns:
        the Class object of the declaring class of this frame's method.
        Throws:
        UnsupportedOperationException - if the StackWalker was not created with Option.RETAIN_CLASS_REFERENCE
      • getFileName

        String getFileName()
        Returns:
        File name of the class containing the current method. May be null.
      • getLineNumber

        int getLineNumber()
        Returns:
        Location of the current point of execution in the source file, or a negative number if this information is unavailable or the method is native.
      • getMethodName

        String getMethodName()
        Returns:
        the name of this StackFrame's method
      • isNativeMethod

        boolean isNativeMethod()
        Returns:
        true if the method represented by this StackFrame is a native method
      • toStackTraceElement

        StackTraceElement toStackTraceElement()
        Converts this StackFrame into a StackTraceElement.
        Returns:
        StackTraceElement
      • getMethodType

        default MethodType getMethodType()
        Returns:
        MethodType containing the parameter and return types for the associated method.
        Throws:
        UnsupportedOperationException - if this method is not overridden
        Since:
        10
      • getDescriptor

        default String getDescriptor()
        Returns:
        method descriptor string representing the type of this frame's method.
        Throws:
        UnsupportedOperationException - if this method is not overridden or the StackWalker instance is not configured with RETAIN_CLASS_REFERENCE.
        Since:
        10