Currently most of the immutable model objects allow setting arbitrary implementation of a property type, thus not enforcing immutability.
Specify the best suited convention to ensure immutability and implement it.
Some possible approaches:
Override all required properties in immutable implementation, declaring the immutable type as property getter return value. This will enforce immutability already at compile time. But it will not work with generic types, e.g. optionals and collections. It will be a breaking API change.
Override builder setters, test the value type and create an immutable copy when needed before setting the value. This behavior is not that transparent to the client. And is more work to implement.
Currently most of the immutable model objects allow setting arbitrary implementation of a property type, thus not enforcing immutability.
Specify the best suited convention to ensure immutability and implement it.
Some possible approaches: