Commit 3c1ee33e authored by Him188's avatar Him188

Fix Java function resolving

parent abf367bd
...@@ -212,7 +212,7 @@ private fun Method.registerEvent( ...@@ -212,7 +212,7 @@ private fun Method.registerEvent(
coroutineContext: CoroutineContext coroutineContext: CoroutineContext
): Listener<Event> { ): Listener<Event> {
this.isAccessible = true this.isAccessible = true
val kotlinFunction = this.kotlinFunction val kotlinFunction = kotlin.runCatching { this.kotlinFunction }.getOrNull()
return if (kotlinFunction != null) { return if (kotlinFunction != null) {
// kotlin functions // kotlin functions
...@@ -232,7 +232,9 @@ private fun Method.registerEvent( ...@@ -232,7 +232,9 @@ private fun Method.registerEvent(
else -> error("function ${kotlinFunction.name} must have one Event param") else -> error("function ${kotlinFunction.name} must have one Event param")
} }
lateinit var listener: Listener<*> lateinit var listener: Listener<*>
kotlinFunction.isAccessible = true kotlin.runCatching {
kotlinFunction.isAccessible = true
}
suspend fun callFunction(event: Event): Any? { suspend fun callFunction(event: Event): Any? {
try { try {
return when (param.size) { return when (param.size) {
......
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