Fix original method invocation argument spreading (#701)#10
Merged
superturtlee merged 1 commit intosuperturtlee:masterfrom Apr 30, 2026
Merged
Fix original method invocation argument spreading (#701)#10superturtlee merged 1 commit intosuperturtlee:masterfrom
superturtlee merged 1 commit intosuperturtlee:masterfrom
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Java (Varargs):
https://docs.oracle.com/javase/8/docs/technotes/guides/language/varargs.html