square/anvil

Duplicate `ContributesMultibinding` check does not consider `ignoreQualifier`

gabrielittner opened this issue · 1 comments

Having ContributesMultibinding once without ignoreQualifier and once with results in an error that the contributions need to be distinct.

@Named("test")
@ContributesMultibinding(AppScope::class, DeepLinkHandler::class)
@ContributesMultibinding(AppScope::class, DeepLinkHandler::class, ignoreQualifier = true)
class FooDeepLink @Inject constructor() : DeepLinkHandler {}
e: com.squareup.anvil.compiler.api.AnvilCompilationException: Back-end (JVM) Internal error: com.freeletics.feature.foo.FooDeepLinkHandler contributes multiple times to the same scope using the same bound type: [DeepLinkHandler]. Contributing multiple times to the same scope with the same bound type is forbidden and all scope - bound type combinations must be distinct.

The distinct check should consider ignoreQualifier as well since it results in 2 distinct contributions.

In this case, there's no need for the qualifier. The unqualified version is contributed to the qualified set as well, so it is in fact a duplicate binding. Am I missing something?

Nevermind, that's not true. I'll take a look.