Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

builder should return interface/abstract #1495

Open
caleb-cushing0-kr opened this issue Nov 27, 2023 · 1 comment
Open

builder should return interface/abstract #1495

caleb-cushing0-kr opened this issue Nov 27, 2023 · 1 comment

Comments

@caleb-cushing0-kr
Copy link

I don't want my build() method to return the ImmutableFoo type, only Foo.

interface Foo {
  class Builder extends ImmutableFoo.Builder {
      abstract Foo build();
  }
}
ImmutableFoo foo = ImmutableBuilder.builder().build(); // compiletime error
Foo foo = ImmutableBuilder.builder().build(); // works
@elucash
Copy link
Member

elucash commented Feb 18, 2024

There's @Style(overshadowImplementation=true) and some other attributes to tune builders. See javadocs, most such styles documented only there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants