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

Qualifiers do not work in subcomponent factory #58

Closed
matejdro opened this issue Oct 25, 2024 · 1 comment
Closed

Qualifiers do not work in subcomponent factory #58

matejdro opened this issue Oct 25, 2024 · 1 comment
Labels
bug Something isn't working enhancement New feature or request

Comments

@matejdro
Copy link

matejdro commented Oct 25, 2024

Following code does not compile:

class MyScope
class SubScope

@Qualifier
annotation class QualifiedString

@Component
@MergeComponent(MyScope::class)
@SingleIn(MyScope::class)
interface MainComponent : MainComponentMerged {
}

@ContributesSubcomponent(SubScope::class)
@SingleIn(SubScope::class)
interface RendererComponent {
   @QualifiedString
   val qualifiedString: String

   @ContributesSubcomponent.Factory(MyScope::class)
   interface Factory {
      fun createRendererComponent(@QualifiedString string: String): RendererComponent
   }
}

It complains that Cannot find an @Inject constructor or provider for: @QualifiedString String, even though that string should have been provided by the subcomponent factory. It appears that qualifier annotations get lost when component is merged.

@vRallev vRallev added enhancement New feature or request bug Something isn't working labels Oct 25, 2024
@vRallev
Copy link
Contributor

vRallev commented Oct 25, 2024

This should work and is a gap.

vRallev added a commit that referenced this issue Oct 25, 2024
Support qualifiers on the factory functions when contributing subcomponents and don't silently drop them.

Fixes #58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants