fast-serialization icon indicating copy to clipboard operation
fast-serialization copied to clipboard

Feature request: require class registration

Open rdicroce opened this issue 7 years ago • 2 comments

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.

rdicroce avatar Jul 19 '18 17:07 rdicroce

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.

andrewl102 avatar Jul 20 '18 10:07 andrewl102

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

RuedigerMoeller avatar Nov 18 '18 21:11 RuedigerMoeller