/** * Constructor that allows subclasses disabling exception suppression and stack traces. Those * features should only be disabled in very specific cases. */ protected Throwable( String message, Throwable cause, boolean enableSuppression, boolean writetableStackTrace) { this.cause = cause; this.detailMessage = message; this.writetableStackTrace = writetableStackTrace; this.disableSuppression = !enableSuppression; if (writetableStackTrace) { fillInStackTrace(); } initializeBackingError(); }
/** * Populates the stack trace information for the Throwable. * * @return this */ @DoNotInline public Throwable fillInStackTrace() { if (writetableStackTrace) { // If this is the first run, let constructor initialize it. // (We need to initialize the backingJsObject from constructor as our own implementation of // fillInStackTrace is not guaranteed to be executed.) if (backingJsObject != UNITIALIZED) { initializeBackingError(); } } return this; }
public Throwable(Throwable cause) { this.detailMessage = (cause == null) ? null : cause.toString(); this.cause = cause; fillInStackTrace(); initializeBackingError(); }
public Throwable(String message, Throwable cause) { this.cause = cause; this.detailMessage = message; fillInStackTrace(); initializeBackingError(); }
public Throwable() { fillInStackTrace(); initializeBackingError(); }