yatagan
yatagan copied to clipboard
Api: Forbid binding to subcomponets directly, tweak component factories.
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.
Codecov Report
Attention: Patch coverage is 85.71429%
with 2 lines
in your changes are missing coverage. Please review.
Project coverage is 83.37%. Comparing base (
e8d3224
) to head (d6bf9d2
).
Additional details and impacted files
@@ Coverage Diff @@
## main #154 +/- ##
============================================
- Coverage 83.71% 83.37% -0.35%
+ Complexity 1555 1538 -17
============================================
Files 191 190 -1
Lines 7548 7523 -25
Branches 1416 1412 -4
============================================
- Hits 6319 6272 -47
- Misses 727 746 +19
- Partials 502 505 +3
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.