It looks like the logic to skip generation of copy methods for abstract classes is flawed.
When making the hierarchy deeper:
open class TimeInterval {}
abstract class Day extends TimeInterval {
...
it even fails to build with "Cannot create an instance of an abstract class." (apart from 'copy' overrides nothing.). This case should also be considered when fixing the implementation of copy.
Marking Day as open instead of abstract can be used to work around this issue.
Try generating Kotlin classes for this template:
The classes
Weekend
andWorkday
contain copy methods:but the class
Day
which they extend:does not define
copy
method, which leads to a compilation error:It looks like the logic to skip generation of
copy
methods for abstract classes is flawed.When making the hierarchy deeper:
it even fails to build with "Cannot create an instance of an abstract class." (apart from
'copy' overrides nothing.
). This case should also be considered when fixing the implementation ofcopy
.Marking
Day
asopen
instead ofabstract
can be used to work around this issue.