Files
openide/platform/object-serializer
Vladimir Krivosheev 62f27fdc07 cleanup
GitOrigin-RevId: 33134ec834e896293f1128f389d9a6c8fa33dd96
2025-06-06 08:47:17 +00:00
..
2025-06-06 08:47:17 +00:00
2025-05-13 18:02:20 +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).