mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-31 19:40:24 +08:00
[console] 修复 JvmPluginInternal 在 Android java.lang.NoSuchMethodError (#2354)
* fix java.lang.NoSuchMethodError fix java.lang.NoSuchMethodError: No virtual method getDeclaredAnnotation(Ljava/lang/Class;)L * fix formatting Co-authored-by: Him188 <Him188@mamoe.net>
This commit is contained in:
parent
372c25024c
commit
0e4d5efd38
@ -126,7 +126,12 @@ internal abstract class JvmPluginInternal(
|
|||||||
parentPermission
|
parentPermission
|
||||||
if (!firstRun) refreshCoroutineContext()
|
if (!firstRun) refreshCoroutineContext()
|
||||||
|
|
||||||
val except = javaClass.getDeclaredAnnotation(ConsoleJvmPluginFuncCallbackStatusExcept.OnEnable::class.java)
|
val except = try {
|
||||||
|
javaClass.getDeclaredAnnotation(ConsoleJvmPluginFuncCallbackStatusExcept.OnEnable::class.java)
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
|
||||||
kotlin.runCatching {
|
kotlin.runCatching {
|
||||||
onEnable()
|
onEnable()
|
||||||
}.fold(
|
}.fold(
|
||||||
@ -244,4 +249,4 @@ internal inline fun AtomicLong.updateWhen(condition: (Long) -> Boolean, update:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal val Throwable.rootCauseOrSelf: Throwable get() = generateSequence(this) { it.cause }.lastOrNull() ?: this
|
internal val Throwable.rootCauseOrSelf: Throwable get() = generateSequence(this) { it.cause }.lastOrNull() ?: this
|
||||||
|
Loading…
Reference in New Issue
Block a user