Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

Optionally auto generate factory interfaces? #128

Closed
davidliu opened this issue Dec 11, 2019 · 3 comments
Closed

Optionally auto generate factory interfaces? #128

davidliu opened this issue Dec 11, 2019 · 3 comments

Comments

@davidliu
Copy link

Seems like it would be better to have the factory interfaces be autogenerated rather than require the boilerplate of declaring an interface (which in turn is mostly a duplicate of the constructor).

@JakeWharton
Copy link
Member

This means that the factories would be public API which is never a good thing. I explain the motivation in this talk: https://jakewharton.com/helping-dagger-help-you/. It's a design decision not to do this, and if you want this behavior you might want to use AutoFactory instead.

@davidliu
Copy link
Author

Sorry, I don't understand what you mean specifically by the factory being public API here (are you referring to the implementation or interface here)? Aren't the interfaces already public APIs?

Were you referring to the fact that they'd be generated and the compilation issues that accompany that (re:AutoFactory)?

@JakeWharton
Copy link
Member

Yes, the generated factories. It violates the whole principle that Dagger, Auto, etc. preach which is that the exposed API is always hand-written and the libraries generate the implementation. This library subscribes to that philosophy, and AutoFactory, weirdly, does not (at least not by default).

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

No branches or pull requests

2 participants