When trying to define a setter that accepts a type of parameter that can be used to build a property, as follows:
class Buffer(buf: String) {} class Foo { var buffer: Buffer? = null set(value: String) { field = Buffer(value) } }
I get an error message:
Setter parameter type must be equal to property type
So what did Kotlin's way of doing this mean?
source share