Hi, I’m testing my model w/ json serialization. I’...
# serialization
a
Hi, I’m testing my model w/ json serialization. I’m serializing my models to json and then deserializing them back into my model object. Nodejs and native mac are working fine, but the test on java is throwing this cryptic error
Copy code
java.lang.ClassCastException: class [[Ljava.lang.Object; cannot be cast to class [[Ljava.lang.Float; ([[Ljava.lang.Object; and [[Ljava.lang.Float; are in module java.base of loader 'bootstrap')
	at raytracer.math.Matrix$$serializer.deserialize(Matrix.kt:9)
	at raytracer.math.Matrix$$serializer.deserialize(Matrix.kt:9)
	at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:63)
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:32)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
	at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
Any ideas of where to look and how to fix that?
r
That seems an awful lot like an error in the code generated by the compiler plugin. Your best bet is probably to make a github issue
As a workaround, try writing a custom serializer for Matrix?
a
Thanks, I’ll try that out.