Chris B
08/15/2024, 4:40 PMkotlinx.serialization.SerializationException
but the error doesn't make sense. This is the error:
Exception in thread "main" kotlinx.serialization.SerializationException: Serializer for subclass 'GridClueSelection' is not found in the polymorphic scope of 'Selection'.
Check if class with serial name 'GridClueSelection' exists and serializer is registered in a corresponding SerializersModule.
To be registered automatically, class 'GridClueSelection' has to be '@Serializable', and the base class 'Selection' has to be sealed and '@Serializable'.
except GridClueSelection
is Serializable, and Selection
is sealed and Serializable.Chris B
08/15/2024, 4:43 PM@Serializable
sealed class Selection { ... }
@Serializable
abstract class ClueSelection(val clueKey : String) : Selection() { ... }
@Serializable
class GridClueSelection( ... ) : ClueSelection(_clueKey) { ... }
Michael Krussel
08/15/2024, 4:46 PMClueSelection
is not sealed, the automatic lookup polymorphism for GridClueSelection
is not getting created, and you will need to manually configure the serializers.Chris B
08/15/2024, 4:46 PMChris B
08/15/2024, 4:48 PMMichael Krussel
08/15/2024, 4:48 PMGridClueSelection
is not in the polymorphic scope of Selection
because it is not a subclass of Selection
and is instead a subclass of ClueSelection
. I don't know if making ClueSelection
sealed will fix it or if you need to manually configure if the polymorphic scope of Selection
.Chris B
08/15/2024, 4:49 PMChris B
08/15/2024, 4:49 PMMichael Krussel
08/15/2024, 4:49 PMChris B
08/15/2024, 4:51 PMJoffrey
08/15/2024, 6:40 PMMichael Krussel
08/15/2024, 8:08 PMObject
obviously won't be sealed or Serializable
.