Hi, We have a `@Serializable sealed class SuperTyp...
# serialization
t
Hi, We have a
@Serializable sealed class SuperType
. Now we decided to add a method to all subtypes that basically create a copy from themselfs. Obvispously they are supposed to return their own type. Hence e cahnged the declaration to
@Serializable sealed class SuperType<T: SuperType<T>>
we can decalre the subtypes like
class SubType: SuperType<SubType>{  override fun createCopy(): SubType = TODO()  }
Unfortunately this seem to create a endless recursion in the compiler plugin generating the serializer for it. is this a known bug? is it a bug at all?
nevermind the problem seems to be deeper. i am unable to reproduce it with a small testcase
c
Don't use generics for this, just do:
Copy code
sealed class A {
  abstract fun foo(): A
}
Copy code
class B : A() {
  override fun foo(): B { ... }
}