Skip to content

Subcomponents parameter of Module annotation doesn't seem to work. #60

Answered by ZacSweers
kylannjohnson asked this question in Q&A
Discussion options

You must be logged in to vote

Yeah this is one of the cases described at the bottom of this section: https:/ZacSweers/anvil/blob/main/FORK.md#2-ksp-component-merging

Anywhere that was not processed by anvil before and referenced anvil merged types need to be updated to use the generated Merged* class instead. In your case, something like this

@[Module(subcomponents = [MergedInitializedComponent::class]) ContributesTo(AppScope::class)]
object InitializerModule {

    @Provides
    fun provideInitializer(factory: InitializedComponent.Factory): Initializer {
        return Initializer(factory)
    }
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kylannjohnson
Comment options

Answer selected by ZacSweers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #57 on August 22, 2024 18:27.