Throwable stackTrace property instead of getStackTrace() function.

This commit is contained in:
Ilya Gorbunov
2015-10-17 12:57:35 +03:00
parent 7208efc784
commit 10784644a5
@@ -1,5 +1,6 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("ExceptionsKt")
@file:Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
package kotlin
import java.io.PrintStream
@@ -24,8 +25,13 @@ public fun Throwable.printStackTrace(stream: PrintStream): Unit {
/**
* Returns the list of stack trace elements in a Kotlin stack trace.
*/
public fun Throwable.getStackTrace(): Array<StackTraceElement> {
val jlt = this as java.lang.Throwable
return jlt.getStackTrace()!!
}
@Deprecated("Use 'stackTrace' property instead.", ReplaceWith("stackTrace"))
@JvmName("getStackTraceDeprecated")
public inline fun Throwable.getStackTrace(): Array<StackTraceElement> = stackTrace
/**
* Returns an array of stack trace elements representing the stack trace
* pertaining to this throwable.
*/
public val Throwable.stackTrace: Array<StackTraceElement>
get() = (this as java.lang.Throwable).stackTrace!!