code: @NullSafe
    public static StackTraceElement[] getStackTrace(Thread thread) {
      return (thread != null ? thread.getStackTrace() : new StackTraceElement[0]);
    }
docs: A null-safe method for getting a snapshot of the Thread's current stack trace.
  
  @param thread the Thread from which the stack trace is returned.
  @return an array of StackTraceElements indicating the stack trace of the specified Thread,
  or an empty StackTraceElement array if the Thread is null.
  @see java.lang.Thread#getStackTrace()
  @see java.lang.StackTraceElement