-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix kotlin child workflow execute varargs #2395
Fix kotlin child workflow execute varargs #2395
Conversation
@@ -28,13 +28,13 @@ import kotlin.reflect.typeOf | |||
*/ | |||
@OptIn(ExperimentalStdlibApi::class) | |||
inline fun <reified T> ChildWorkflowStub.execute(vararg args: Any?): T { | |||
return execute(T::class.java, typeOf<T>().javaType, args) | |||
return execute(T::class.java, typeOf<T>().javaType, *args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If not spread here, the args
are considered a single argument to the java execute
function.
So if passing in a single string arg like "my-arg", the child workflow will receive [ "my-arg" ]
as it's first argument, rather than "my-arg"
Hey, thanks for the contribution. I think Activities also have the same issue, are you able to resolve that as part of this PR as well? |
a57a47d
to
a7b8bd2
Compare
a7b8bd2
to
f877a63
Compare
Updated to include the activity executes |
@Quinn-With-Two-Ns anything I need to do here? |
Looks like CI is failing, can you please make sure tags are pushed to your branch? don't think I can push them for you. Then let me know and I will re-run CI. Thanks! |
@Quinn-With-Two-Ns which tags? I haven't created any new ones. Pushing all failed for me ( I've synced the fork now, not sure if that helps |
What was changed
The kotlin
execute
extension functions on child workflows aren't working for me. My args are wrapped in an array, causing my child workflow to fail when deserializing it's workflow arguments.I'm no expert on kotlin/java varargs, but it seems to me that the varargs need to be spread so that the java code sees varargs, not a one element array of varargs.
I've added test cases that fail in the way that I'm seeing if the spread operator is dropped, and ensure correct functioning going forward.
Related issues: #2018
Why?
I'm using untyped child workflows myself, and passing my arguments through is leading to workflow failures.
Checklist
Closes n/a
How was this tested:
execute
function that includes the spread, and this works as expectedn/a