cuba-platform / cuba

CUBA Platform is a high level framework for enterprise applications development
https://www.cuba-platform.com
Apache License 2.0
1.34k stars 219 forks source link

Add Kryo serializer for java.util.Optional #1157

Open alexbudarov opened 6 years ago

alexbudarov commented 6 years ago

Description of the bug or enhancement

Optional in Java 8 is not serializable. It makes inconvenient to use it in CUBA applications, because Optional can't be a result of a middleware service method. And middleware services are an essential internal part of CUBA application.

But for those people who use Kryo serialization - it is easy (and safe?) to make Optional kryo-serializable.

jreznot commented 6 years ago

Isn't it a trap that somehow Optional will be Serializable in cuba only with Kryo? Do you want to stick with only one serialization option?

alexbudarov commented 6 years ago

Choosing serialization implementation is not an option for us. Kryo is just so much better that there is no choice for us (who use remote thick client).

jreznot commented 6 years ago

Is it OK if we just provide you options to enable this behavior ?

alexbudarov commented 6 years ago

Well, we already can subclass KryoSerialization and register the serializer ourselve if we want.