Is there any way/trick to enforce that classes imp...
# serialization
d
Is there any way/trick to enforce that classes implementing a specific interface should always be annotated as
@Serializable
?
Copy code
interface ScreenParams

@Serializable
data class CountriesListParams(val listType: CountriesListType) : ScreenParams

@Serializable
data class CountryDetailParams(val countryName: String) : ScreenParams
all these 3 definitions are on different files, so it can happen to forget to set
@Serializable
If the annotation is forgotten, the app would crash at runtime when visiting that specific screen.
s
Serializable classes implementing an interface should be registered in a polymorphic module. You can't register a class if its not serializable
d
At the moment, I am not registering any polymorphic module and it still seems to decode correctly