Closed Gaming32 closed 1 year ago
Maybe this is correct that it should error here, but this exception is not a very useful error message for users of knbt.
Good callout!
I know the version of kotlinx.serialization that knbt v0.11 uses didn't properly support marking sealed interfaces @Serializable
(which works seamlessly with sealed classes) and I had to special case NbtTag
serialization. Might just be a matter of updating kotlinx.serialization to v1.4.0 so it has the fix, or maybe compiling against a newer version of Kotlin with a fixed serializer compiler plugin
Just added some tests locally to see if I could reproduce this, and I did get a failure with something I expected to work, though the error is different. That's something I'll have to fix
Could you share a reproducer to make sure I found the same issue? And maybe the kotlinx.serialization plugin version your project's using?
gradle :dependencies
I'm on kotlinx.serialization
1.4.0. Your code is pretty much what I had, so it's definitely the same issue.
If you attempt to serialize an
NbtTag
and have a subclass of that tag, aSerializationException
occurs.