Skip to content

Contextual with Element throws Inline classes can not be decoded directly #220

@hfhbd

Description

@hfhbd

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingindevThe issue is fixed/implemented in the dev branch

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions