public class TestBean {
private String invisible;
private Integer count;
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
}
public class DerivedBean extends TestBean {
private String name;
}
generating the builder for DerivedBean including fields name and count (from superclass) the generated builder constructor with parameter DerivedBean does not compile:
private Builder(DerivedBean derivedBean) {
this.name = derivedBean.name;
this.count = derivedBean.count; // <-- error: The field TestBean.count is not visible
}
In my opinion, in this case the generated code should look like:
private Builder(DerivedBean derivedBean) {
this.name = derivedBean.name;
this.count = derivedBean.getCount(); // <-- use getter here
}
If there is no visible getter for the field, it should probably be omitted.
Activate the following two options:
With this input
generating the builder for DerivedBean including fields name and count (from superclass) the generated builder constructor with parameter DerivedBean does not compile:
In my opinion, in this case the generated code should look like:
If there is no visible getter for the field, it should probably be omitted.