# Uses of Class
java.lang.StackTraceElement

Packages that use StackTraceElement
Package
Description
java.lang
Provides classes that are fundamental to the design of the Java programming language.
java.lang.management
Provides the management interfaces for monitoring and management of the Java virtual machine and other components in the Java runtime.
jdk.dynalink
Contains interfaces and classes that are used to link an `invokedynamic` call site.
jdk.jshell.spi
Defines the Service Provider Interface for pluggable JShell execution engines.

- ## Uses of StackTraceElement in java.lang

  Methods in java.lang that return StackTraceElement
  Modifier and Type
  Method
  Description
  `StackTraceElement[]`
  Thread.`getStackTrace()`
  Returns an array of stack trace elements representing the stack dump of this thread.
  `StackTraceElement[]`
  Throwable.`getStackTrace()`
  Provides programmatic access to the stack trace information printed by `Throwable.printStackTrace()`.
  `StackTraceElement`
  StackWalker.StackFrame.`toStackTraceElement()`
  Returns `StackTraceElement` for this stack frame.
  Methods in java.lang with parameters of type StackTraceElement
  Modifier and Type
  Method
  Description
  `void`
  Throwable.`setStackTrace(StackTraceElement[] stackTrace)`
  Sets the stack trace elements that will be returned by `Throwable.getStackTrace()` and printed by `Throwable.printStackTrace()` and related methods.

- ## Uses of StackTraceElement in java.lang.management

  Methods in java.lang.management that return StackTraceElement
  Modifier and Type
  Method
  Description
  `StackTraceElement`
  MonitorInfo.`getLockedStackFrame()`
  Returns the stack frame that locked the object monitor.
  `StackTraceElement[]`
  ThreadInfo.`getStackTrace()`
  Returns the stack trace of the thread associated with this `ThreadInfo`.
  Constructors in java.lang.management with parameters of type StackTraceElement
  Modifier
  Constructor
  Description
  ``
  `MonitorInfo(String className, int identityHashCode, int stackDepth, StackTraceElement stackFrame)`
  Construct a `MonitorInfo` object.

- ## Uses of StackTraceElement in jdk.dynalink

  Methods in jdk.dynalink that return StackTraceElement
  Modifier and Type
  Method
  Description
  `static StackTraceElement`
  DynamicLinker.`getLinkedCallSiteLocation()`
  Returns a stack trace element describing the location of the `invokedynamic` call site currently being linked on the current thread.

- ## Uses of StackTraceElement in jdk.jshell.spi

  Constructors in jdk.jshell.spi with parameters of type StackTraceElement
  Modifier
  Constructor
  Description
  ``
  `ResolutionException(int id, StackTraceElement[] stackElements)`
  Constructs an exception indicating that a `DeclarationSnippet` with unresolved references has been encountered.
  ``
  `UserException(String message, String causeExceptionClass, StackTraceElement[] stackElements)`