Files
openide/platform/object-serializer
Nikita Skvortsov b0e935822d [core] fix caching of PooledBlockAllocators IDEA-253956
Each each time an IonManagedBinaryWriter is created, two instances of BlockAllocator are required. But PooledBlockAllocatorProvider caches only one instance, so each time second instance is created and new memory block is allocated. This repeats for all objects without default constructor in deserialized object graph and may cause significant slowness

Signed-off-by: Nikita Skvortsov <Nikita.Skvortsov@jetbrains.com>

GitOrigin-RevId: bf8c46c14b9c1aa2fb22506539d016cfd2188be5
2020-11-13 08:25:32 +00:00
..

Default constructor is not required for objects, but highly recommended.

Objenesis doesn't call class constructor at all, it means that field initializers will be not called and you can get strange NPEs on runtime. So, some constructor is always required.

Create default constructor and initialize final fields with some values. beanConstructed event can be used to resolve or check object. Or if it is not an option, annotate constructor with PropertyMapping.

Annotation PropertyMapping impacts deserialization performance and still leave question opened — what if not all required fields are defined? Still, annotation was supported as solution because quite often better to not change classes just because of serialization needs.

Note about parameters names — you have to specify names because option to store formal parameter names turned off by default (and it is not wise to enable it since parameter names are required only for a few constructors).