From cf1153e025318045d76ba64d0667e2a41c58ceaf Mon Sep 17 00:00:00 2001 From: Hd <49312623+HdShare@users.noreply.github.com> Date: Wed, 29 Apr 2026 21:50:53 +0800 Subject: [PATCH] Fix original method invocation argument spreading (#701) In the proceedInvocation method of `BaseInvoker.kt`, specifically within the Invoker.Type.Origin block, the arguments array was being passed to the JNI bridge as a single object instead of being expanded into individual parameters. In Kotlin, when a function accepts a variable number of arguments (vararg), passing an existing array variable requires the spread operator (*). Without this operator, the compiler treats the entire array as the first and only element of the vararg parameter. This mismatch causes the JNI bridge to receive a parameter count of 1 (the array itself) regardless of the actual number of elements, resulting in IllegalArgumentExceptions. Documentation References: Kotlin (Variable number of arguments): https://kotlinlang.org/docs/functions.html#variable-number-of-arguments-varargs > If you already have an array and want to pass its contents to a function as a vararg parameter or as a part of it, use the spread operator by prefixing the array name with *. Java (Varargs): https://docs.oracle.com/javase/8/docs/technotes/guides/language/varargs.html > multiple arguments must be passed in an array --- .../src/main/kotlin/org/matrix/vector/impl/hooks/BaseInvoker.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xposed/src/main/kotlin/org/matrix/vector/impl/hooks/BaseInvoker.kt b/xposed/src/main/kotlin/org/matrix/vector/impl/hooks/BaseInvoker.kt index 013d57914..c800fd89a 100644 --- a/xposed/src/main/kotlin/org/matrix/vector/impl/hooks/BaseInvoker.kt +++ b/xposed/src/main/kotlin/org/matrix/vector/impl/hooks/BaseInvoker.kt @@ -30,7 +30,7 @@ internal abstract class BaseInvoker, U : Executable>( return when (val currentType = type) { is Invoker.Type.Origin -> { try { - HookBridge.invokeOriginalMethod(executable, thisObject, args) + HookBridge.invokeOriginalMethod(executable, thisObject, *args) } catch (e: InvocationTargetException) { throw e.cause ?: e }