As @maxschlosser correctly identified in https://github.com/kopykat-kt/kopykat/issues/62#issuecomment-1276478384, the issue comes from not preserving nullability information when generating the "mutation info", that is, the mapping of properties that go into the Class$Mutable type generated as part of "mutable copy". It turns out that KSP's KSType.toClassName was not respecting this information, so the solution has been to hack own on toClassNameRespectingNullability.
Fixes #62
As @maxschlosser correctly identified in https://github.com/kopykat-kt/kopykat/issues/62#issuecomment-1276478384, the issue comes from not preserving nullability information when generating the "mutation info", that is, the mapping of properties that go into the
Class$Mutable
type generated as part of "mutablecopy
". It turns out that KSP'sKSType.toClassName
was not respecting this information, so the solution has been to hack own ontoClassNameRespectingNullability
.