fast-serialization
fast-serialization copied to clipboard
Feature request: require class registration
It would be nice if FST had an option to require classes to be registered.
Use case: helps developers to get maximum speed and minimum size for serialized objects by making it obvious when an unregistered class is being serialized.
Kryo has the option to fail (throw exception) or just warn when an unregistered class gets serialized.
See also https://github.com/RuedigerMoeller/fast-serialization/issues/235 : multithreaded access has issues if the classes aren't preregistered.
I worked around this by providing a special FSTObjectOutput that tracks all classes and ensures that preregistration occurs.
By using this, it can deduce all preregistered objects with a compile safe example object to ensure no class names need to be serialized.
just fill in the necessary check the code around ClassRegistry to catch the point a class id is generated and make a pull request. Could be an option at FSTConfiguration