mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-03 02:28:24 +08:00
Fix Java function resolving
This commit is contained in:
parent
abf367bd5c
commit
3c1ee33ee0
@ -212,7 +212,7 @@ private fun Method.registerEvent(
|
||||
coroutineContext: CoroutineContext
|
||||
): Listener<Event> {
|
||||
this.isAccessible = true
|
||||
val kotlinFunction = this.kotlinFunction
|
||||
val kotlinFunction = kotlin.runCatching { this.kotlinFunction }.getOrNull()
|
||||
return if (kotlinFunction != null) {
|
||||
// kotlin functions
|
||||
|
||||
@ -232,7 +232,9 @@ private fun Method.registerEvent(
|
||||
else -> error("function ${kotlinFunction.name} must have one Event param")
|
||||
}
|
||||
lateinit var listener: Listener<*>
|
||||
kotlinFunction.isAccessible = true
|
||||
kotlin.runCatching {
|
||||
kotlinFunction.isAccessible = true
|
||||
}
|
||||
suspend fun callFunction(event: Event): Any? {
|
||||
try {
|
||||
return when (param.size) {
|
||||
|
Loading…
Reference in New Issue
Block a user