Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Component.Factory types must be nested within a @Component #790

Open
mustafatatarhan0 opened this issue Nov 21, 2023 · 3 comments
Open

Comments

@mustafatatarhan0
Copy link

mustafatatarhan0 commented Nov 21, 2023

AppComponent.kt:

@SingleIn(AppScope::class)
@MergeComponent(AppScope::class)
interface AppComponent : NodeFactoriesBindings {

    @Component.Factory
    interface Factory {
        fun create(
            @ApplicationContext @BindsInstance
            context: Context,
        ): AppComponent
    }
}

When anvil generate AppComponent.java, error comes:
error: @Component.Factory types must be nested within a @Component

What is the reason of this error ? How can I fix this ?

@b-reetz
Copy link

b-reetz commented Feb 13, 2024

I too have the same problem, and with @Component.Builder

@kevinguitar
Copy link

I have the same issue building with ksp, @mustafatatarhan0 are you building with ksp as well?

@jamesonwilliams
Copy link

@kevinguitar I ran into this while trying to use Dagger KSP, too, yeah. I think in short, the deal is that Anvil doesn't currently support Dagger KSP.

However, this draft PR #1001 went up 2 days ago, which is directly about getting the @Component.Factory and @Component.Builder to work under an @MergeComponent. Very exciting stuff!

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

No branches or pull requests

4 participants