Paul Woitaschek
11/10/2021, 1:05 PMevant
11/10/2021, 3:36 PMinterface Feature1Component {
...
}
@Component
abstract class AppComponent : Feature1Component {
...
}
or by composition
@Component
abstract class Feature1Component {
...
}
@Component
abstract class AppComponent(@Component val feature1: Feature1Component = Freature1Component::class.create()) {
...
}
If you are worried about those extra members on your component being visible to downstream code you can always hide it behind an interface
interface AppComponent {
val app: App
}
@Component
abstract class AppComponentImpl : AppComponent, Feature1Component
though I don't think it ends up being a big deal in practice.
And most of the times in a gradle module I module internal dependencies that are used to create an objectOn the other hand this is something I'd like to improve on. The way the code generation works right now your dependencies end up having to be publicly visible in most cases. I do want to relax this.