Open magicwerk opened 2 years ago
try
Predicate<String> filter = (Predicate<String> & Serializable) (s) -> s.startsWith("a");
this will make the lambda serializable
idk if there are other solutions
I'm aware of how lambdas can be made explicitly Serializable as shown, thanks. The interesting part however would be whether FST somehow manages to serialize lambdas not defined as Serializable, as it manages to serialize classes not implementing Serialiazable.
I try to use FST to serialize Java objects where not all contained instances are Serializable by using
FSTConfiguration.getDefaultConfiguration().setForceSerializable(true)
However this does not seem to work for classes containing lambdas: java.lang.ClassNotFoundException: eval.fst.EvalFst$NoSerializableLambda$$Lambda$3/205962452
class NoSerializableLambda { Predicate filter = (s) -> s.startsWith("a");
}
Is there a way to configure FST so also lambdas can be serialized?