Copy builder uses getters even when they dont exist
AttePietikainen opened this issue · 0 comments
AttePietikainen commented
In the version 1.1.5, the copy builder has started using getX() methods instead of just the field. So if there is a field without a getter function, like most public final fields would not have, the copy builder generated does not work properly.
Say we have the following class
public class Foo {
public final String bar;
}
This would generate builder like
public static final class Builder {
private String bar;
public Builder() {
}
public Builder(final Foo copy) {
this.bar = copy.getBar();
}
public Builder withBar(final String bar) {
this.bar = bar;
return this;
}
public Foo build() {
return new Foo(this);
}
}
this.bar = copy.getBar();
This part is not valid code as the class does not have getBar function