Uploaded image for project: 'Corda'
  1. CORDA-1403

Delegate Property doesn't serialise - type mismatch error

    Details

      Description

      Something like this unit test (added to code) fails where it thinks C isn't a subtype of the interface extends. This will be some Java generics issue

          interface DataClassByInterface<V> {
              val v : V
          }
      
          @Test
          fun dataClassBy() {
              data class C (val s: String) : DataClassByInterface<String> {
                  override val v: String = "-- $s"
              }
      
              data class Inner<T>(val wrapped: DataClassByInterface<T>) : DataClassByInterface<T> by wrapped {
                  override val v = wrapped.v
              }
      
              val i = Inner(C("hello"))
      
              val bytes = SerializationOutput(testDefaultFactory()).serialize(i, testSerializationContext)
      
              // THIS WILL EXPLODE
              val i2 = DeserializationInput(testDefaultFactory()).deserialize(bytes, testSerializationContext)
          }
      

        Attachments

          Activity

            People

            • Assignee:
              Katelyn.Baker Katelyn Baker
              Reporter:
              Katelyn.Baker Katelyn Baker
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: