Use of @DeprecatedConstructorForDeserialization annotation does not seem to be working within the test class for State Class Evolution when existing non nullable parameter is changed to nullable

Description

Hi, Insurewave were following the documentation for Default Class Evolution (states deserialization) using annotation
@DeprecatedConstructorForDeserialization and gave a simple easily reproducible example (via test framework) which i attach below (add to EvolvabilityTests.kt) :

  • this relies on the original version of CC class being serialised without the second parameter using this code :

so i confirmed this does not work with @DeprecatedConstructorForDeserialization annotation since the constructor does not get called via the deserialize method - I verified this does not work with @DeprecatedConstructorForDeserialization annotation by setting breakpoint in the deprecated constructor - it does not get called via the deserialize method when the parameter is being changed to nullable - I can get it working by changing the annotation to @ConstructorForDeserialization (but this means State Evolution is not being tested and there can only be one instance of this @ConstructorForDeserialization (this obviously does not support the concept of Evolution).

so the question I have is this just down to the way these tests are written i.e is the documentation below still valid when used for State Evolution via Corda state deserialization

so the question I have is this just down to the way these tests are written i.e is the documentation below still valid when used for State Evolution via Corda state deserialization ? :

https://docs.corda.r3.com/serialization-default-evolution.html?highlight=deprecatedconstructorfordeserialization

 

This issue is raised on github also:

Assignee

Chris Rankin

Reporter

Amos Smith

Labels

Priority

High

Fix versions

Ported to...

None

Feature Team

Kernel Group

CVSS Vector

None

Engineering Teams

None

Severity

Medium

Sprint

None

Affects versions

Configure