Added in API level 34

Option

class Option
kotlin.Any
   ↳ kotlin.Enum<java.lang.StackWalker.Option>
   ↳ java.lang.StackWalker.Option

Stack walker option to configure the stack frame information obtained by a StackWalker.

Summary

Enum values

Retains Class object in StackFrames walked by this StackWalker.

Shows all hidden frames.

Shows all reflection frames.

Enum values

RETAIN_CLASS_REFERENCE

Added in API level 34
enum val RETAIN_CLASS_REFERENCE : StackWalker.Option

Retains Class object in StackFrames walked by this StackWalker.

A StackWalker configured with this option will support StackWalker#getCallerClass() and StackFrame.getDeclaringClass().

SHOW_HIDDEN_FRAMES

Added in API level 34
enum val SHOW_HIDDEN_FRAMES : StackWalker.Option

Shows all hidden frames.

A Java Virtual Machine implementation may hide implementation specific frames in addition to reflection frames. A StackWalker with this SHOW_HIDDEN_FRAMES option will show all hidden frames (including reflection frames).

SHOW_REFLECT_FRAMES

Added in API level 34
enum val SHOW_REFLECT_FRAMES : StackWalker.Option

Shows all reflection frames.

By default, reflection frames are hidden. A StackWalker configured with this SHOW_REFLECT_FRAMES option will show all reflection frames that include java.lang.reflect.Method#invoke and java.lang.reflect.Constructor#newInstance(Object...) and their reflection implementation classes.

The SHOW_HIDDEN_FRAMES option can also be used to show all reflection frames and it will also show other hidden frames that are implementation-specific.