xmlutil icon indicating copy to clipboard operation
xmlutil copied to clipboard

Contextual with Element throws Inline classes can not be decoded directly

Open hfhbd opened this issue 1 year ago • 10 comments
trafficstars

This did work with 0.86.3:

@Serializable
data class Box(
  @Contextual
  @XmlElement val i: Instant
)

@Test
fun a() {
  val box: Box = XML.defaultInstance.decodeFromString(
  """<?xml version="1.0" encoding="UTF-8"?>
     <Box>
       <i>2023-11-02T15:56:49.364+01:00</i>
     </Box>
  """.trimIndent()
  )
}

With 0.90.1:

In: Box/i Error: 3:21 - Inline classes can not be decoded directly
nl.adaptivity.xmlutil.XmlException: In: Box/i Error: 3:21 - Inline classes can not be decoded directly
	at nl.adaptivity.xmlutil.serialization.XmlDecoderBase$TagDecoderBase.decodeSerializableElement(XMLDecoder.kt:856)
	at SerializationTest$Box$$serializer.deserialize(SerializationTest.kt:14)

hfhbd avatar Jun 18 '24 10:06 hfhbd