Is there a way to require a generic type to be a data class in Kotlin?
I have the feeling that what you actually want is that T should be able to copy itself with a new ID, and have an ID. Not necessarily that it is a data class. So you could just use an interface to define that. For example: interface CopyableWithId<out T> where T: CopyableWithId<T> { fun copy(newId: … Read more