title: Corda State Evolution - nullable vs. default properties
body: <p>In Corda, adding new properties to states (state evolution) requires that new properties are nullable in order to remain backwards compatible with previous versions of the state.</p>
  
  <pre><code>data class Version1DummyState(
      override val participants: List&lt;AbstractParty&gt;
  ) : ContractState
  
  data class Version2DummyState(
      override val participants: List&lt;AbstractParty&gt;,
      val myNewProperty: String? = null
  ) : ContractState
  </code></pre>
  
  <p>Since Kotlin also supports properties with default values, I'd like to know why state evolution is restricted to properties of <strong>nullable</strong> types only, but not non-nullable properties, provided that those properties have a default value?</p>
  
  <pre><code>data class Version2DumyState(
      override val participants: List&lt;AbstractParty&gt;,
      val myNewProperty: String = "Hello, world."
  ) : ContractState
  </code></pre>
  
  <p>My rationale for asking this came from looking at the implicit upgrade sample, in which the obligation state is upgraded to allow the obligor to default on their obligation. <code>true</code> and <code>false</code> accurately represent whether the obligor has defaulted, but <code>null</code> does not. The ability to upgrade with a default value of <code>false</code> seems more natural than using a nullable field.</p>