It may worth having generated serializer code for performance reasons. However, this should be proved with benchmarks.
Let's prototype object serializer for type-system described in IEP-54, and benchmark them to check if generated code approach is a better one.
- As we go with Java11 then VarHandles must be used instead of Unsafe.
- For generated serializer we can use: JDK compiler + Javapoet project (Java code generator) or Janino compiler or even Prestodb-bytecode module of PrestoDB project
UPD: JDK compile is too slow, Janino doesn't support Java9+ and VarHandles, Prestodb-bytecode has an unwanted Guava dependency.
So, forking Prestodb without Guava looks like a preferable way.