Here is a reduced version of a case I see in real code:
class BuilderInheritance {
abstract static class Base {
abstract String getProp();
abstract static class Builder<B extends Builder<?>> {
abstract B setProp(String value);
}
}
@AutoValue
abstract static class Sub extends Base {
static Builder builder() {
return new AutoValue_BuilderInheritance_Sub.Builder();
}
@AutoValue.Builder
abstract static class Builder extends Base.Builder<Builder> {
abstract Sub build();
}
}
}
The returns receiver checker reports an error for this code, as the generated setProp method for the AutoValue Builder has @This on the return, but the method in the abstract Base.Builder class does not (so it is an invalid override).
I don't know how to automatically fix this case other than looking for all overriding methods in the visitor to decide if @This should be injected. @kelloggm any thoughts?
Here is a reduced version of a case I see in real code:
The returns receiver checker reports an error for this code, as the generated
setPropmethod for the AutoValue Builder has@Thison the return, but the method in the abstractBase.Builderclass does not (so it is an invalid override).I don't know how to automatically fix this case other than looking for all overriding methods in the visitor to decide if
@Thisshould be injected. @kelloggm any thoughts?