Commit 27fe2406 authored by Him188's avatar Him188

Fix addSuppressed, close #116

parent 340dc403
......@@ -4,9 +4,8 @@ import android.os.Build
private var isAddSuppressedSupported: Boolean = true
@MiraiInternalAPI
@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
actual fun Throwable.addSuppressed(e: Throwable) {
@PublishedApi
internal actual fun Throwable.addSuppressedMirai(e: Throwable) {
if (this === e) {
return
}
......
......@@ -9,9 +9,8 @@
package net.mamoe.mirai.utils
@MiraiInternalAPI
@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
expect fun Throwable.addSuppressed(e: Throwable)
@PublishedApi
internal expect fun Throwable.addSuppressedMirai(e: Throwable)
@MiraiInternalAPI
@Suppress("DuplicatedCode")
......@@ -24,7 +23,7 @@ inline fun <R> tryNTimes(repeat: Int, block: (Int) -> R): R {
} catch (e: Throwable) {
if (lastException == null) {
lastException = e
} else lastException!!.addSuppressed(e)
} else lastException!!.addSuppressedMirai(e)
}
}
......@@ -42,7 +41,7 @@ inline fun <R> tryNTimesOrNull(repeat: Int, block: (Int) -> R): R? {
} catch (e: Throwable) {
if (lastException == null) {
lastException = e
} else lastException!!.addSuppressed(e)
} else lastException!!.addSuppressedMirai(e)
}
}
......@@ -61,7 +60,7 @@ inline fun <R> tryNTimesOrException(repeat: Int, block: (Int) -> R): Throwable?
} catch (e: Throwable) {
if (lastException == null) {
lastException = e
} else lastException!!.addSuppressed(e)
} else lastException!!.addSuppressedMirai(e)
}
}
......
......@@ -2,9 +2,8 @@ package net.mamoe.mirai.utils
private var isAddSuppressedSupported: Boolean = true
@MiraiInternalAPI
@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
actual fun Throwable.addSuppressed(e: Throwable) {
@PublishedApi
internal actual fun Throwable.addSuppressedMirai(e: Throwable) {
if (this === e) {
return
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment