import kotlinx.serialization.Serializable
@Serializable
sealed class Exercise(open val id: String) {
@Serializable
data class Theory(override val id: String) : Exercise(id)
}
我的代码中有这种密封类,编译器说我:
Serializable class has duplicate serial name of property 'id', either in the class itself or its supertypes
.
有没有办法在可序列化的密封类中打开 val,在覆盖它时可以正常工作?