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
gildor
12/12/2019, 5:52 AM
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
Jaymin.Kim
12/12/2019, 6:07 AM
Lambda code to String using scripting. that's my idea.
g
gildor
12/13/2019, 2:46 AM
Scripting can compile and execute string as Kotlin code, but it cannot convert lambda object to source code
gildor
12/13/2019, 2:46 AM
Also source code of lamda is not enough, it also may have state