Shadow addSuppressed member with an extension
#KT-38777
This commit is contained in:
@@ -65,6 +65,7 @@ public actual fun Throwable.stackTraceToString(): String {
|
||||
* suppressed in order to deliver this exception.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
@kotlin.internal.HidesMembers
|
||||
public actual fun Throwable.addSuppressed(exception: Throwable) {
|
||||
if (this !== exception)
|
||||
IMPLEMENTATIONS.addSuppressed(this, exception)
|
||||
|
||||
@@ -81,6 +81,11 @@ class ExceptionJVMTest {
|
||||
e1.addSuppressed(e2)
|
||||
}
|
||||
|
||||
@Test fun addSuppressedSelfDoesNotThrow() {
|
||||
val e1 = Throwable()
|
||||
e1.addSuppressed(e1) // should not throw
|
||||
}
|
||||
|
||||
@Test fun circularCauseStackTrace() {
|
||||
val e1 = Exception("cause")
|
||||
val e2 = Error("induced", e1)
|
||||
|
||||
Reference in New Issue
Block a user