mirror of
https://github.com/corda/corda.git
synced 2025-05-02 16:53:22 +00:00
Refactor `FlowStateMachineImpl.transientValues` and `FlowStateMachineImpl.transientState` to stop the fields from exposing the fact that they are nullable. This is done by having private backing fields `transientValuesReference` and `transientStateReference` that can be null. The nullability is still needed due to serialisation and deserialisation of flow fibers. The fields are transient and therefore will be null when reloaded from the database. Getters and setters hide the private field, allowing a non-null field to returned. There is no point other than in `FlowCreator` where the transient fields can be null. Therefore the non null checks that are being made are valid. Add custom kryo serialisation and deserialisation to `TransientValues` and `StateMachineState` to ensure that neither of the objects are ever touched by kryo.