Has anyone found a way to pass a lambda in a Seria...
# announcements
j
Has anyone found a way to pass a lambda in a Serializable object?
g
How scripting related to serializable lambda?
You cannot serialize generic lambda. Depends on what you actually trying to achieve, but In general way you should mark lambda as
@Trasient
and avoid serialization
But you also can have a class that extends functional interface and Serializable, so type of field of this class also should have multiple bounds functional interface and Serializable
j
Lambda code to String using scripting. that's my idea.
g
Scripting can compile and execute string as Kotlin code, but it cannot convert lambda object to source code
Also source code of lamda is not enough, it also may have state