Api: Forbid binding to subcomponets directly, tweak component factories. #154
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before the patch, if a child component didn't have a builder its instance could be injected directly. Such behavior is confusing and vanilla dagger doesn't support that.
The reasons of why this behavior was here in the
first place are historical and date back to the time when yatagan didn't support child components factory methods, and relied solely on
Module.subcomponents
.This patch removes the confusing behavior and makes it as in vanilla dagger.
Also, now every method in a component interface returning a non-root component is considered a component-factory. Before the patch only the methods with arguments were considered a factory. However, this imposes new restrictions
on how component instances can be exposed from component interfaces, as such usages will now be considered as factories, not entry-points. This leads to some tweaks in tests. But such cases seem of little use in the real world scenarios. And, anyway, that's still how vanilla dagger works.
This is a breaking change, but it's okay for 2.0.