Open asngeo opened 2 years ago
Could anyone take a look for this issue? Many thanks!
It's not possible at the moment.
Either you need resolution to find out which methods to override in a subclass, or some sophisticated concept of a SELF
type that you can use as return type for the chainable setter methods. Both do not exist in Lombok and will probably not in the foreseeable future.
Describe the bug The @Accessors doesn't support inherted class well. It can't return the subclass type when calling a setter of superclass on a subclass instance.
To Reproduce For example, there are two classes:
I can't do such things:
new Child().id(1).name("name");
because the definition of the id setter actually is:public Parent id(int id)
.Expected behavior I hope the usage like
new Child().id(1).name("name");
can work. I think that we can use covarient type to override the chain-setters in subclasses just likepublic Child id(int id)
.Version info (please complete the following information):
Thanks, Geo