This is related to the following question:
How to improve the builder pattern?
I\'m curious whether it\'s possible to implement a builder with the following
Why don't you want to override the setters in BuilderFinal? They would just need to downcast the super method:
public static class BuilderFinal extends BuilderC {
@Override
public BuilderFinal a(int v) {
return (BuilderFinal) super.a(v);
}
@Override
public BuilderFinal b(int v) {
return (BuilderFinal) super.b(v);
}
public Foo build() {
return new Foo(
a(),
b(),
c());
}
}