Hey guys, I have the following scenario: I want to...
# announcements
o
Hey guys, I have the following scenario: I want to send a lambda/function to a different thread defined in a different module too. Both threads (sender and receiver) have a common dependency where the lambdas/functions are defined. However when I serialize the lambda to a byte array in line number 17, ::toLong is not referencing the definition of such function in Lambdas.kt but something like Main$1$… what makes module C not being able to deserialize it because is not able to find the class Main$1$… since it does not have the dependency. Why is it ::toLong not referencing the definition contained in Lambdas.kt of module A?
d
Hi @Oscar Torreno, please, try to wrap the function
toLong
into a class and store the function into a val of this class. Maybe it is not being able to find the class where the function resides.
o
This works! thanks. But it does not look like a clean solution for this, let’s see if anybody else can figure out another solution