In our documentation we say fields can be added to a state class (via @DeprecatedConstructorForDeserialization). We also say that nullable fields can be removed from the state class.
Doing both of these on one state class doesn't work. The EvolutionObjectBuilder gets very confused and throws array index out of bound error. The stack trace seems to get swallowed.
This is the doc I’m refering to: https://docs.corda.r3.com/releases/master/serialization-default-evolution.html
Here’s what I did:
Start with this state class
Put a state on the ledger
Then update the state class to this (add field)
Run vault query, it will come back as expected
Then update the state class to this (remove field)
Run vault query, you will get an error
RPC failed: net.corda.core.CordaRuntimeException: java.lang.ArrayIndexOutOfBoundsException: net.corda.core.contracts.TransactionState (erased) -> data(net.corda.core.contracts.ContractState) -> com.template.states.TemplateState -> 2