I have a question about <Anvil>, as I see that `Co...
# squarelibraries
w
I have a question about Anvil, as I see that
ContributesBinding
doesn’t support multibindings or qualifiers. Is support planned (or will be accepted if someone contributes), or there are some issues with it/it’s not in the scope of the library?
r
It’s by design that these use cases aren’t supported and it’s easier to create a Dagger module in these cases. I believe that these scenarios can’t be modeled nicely in an annotation.
w
I suppose it's not easy accommodating all Dagger features 😕 so in your codebases you're fine with the boilerplate required for multi bindings and qualified provisions, or you're looking into possible solutions?
Btw would allowing the user to add any annotations to the generated binding be possible? Like having "annotations" property on the
ContributesBinding
that'd contain annotations to pass onto the binding site?
r
To be very clear: we don’t want to replace Dagger or change how it works in any way. Modules are fine, binding and provider methods are fine. It’s just the “pure” binding methods that felt like boilerplate and that’s the majority in our codebase. So this annotation is still a win. No, a separate
annotations
property wouldn’t work, because the qualifier annotations can attributes themselves, e.g.
@SingleIn(AppScope::class)
. You can’t express that in an attribute.
w
I totally understand the boilerplate argument, I’m just wondering because we do have quite a lot of multibindings and qualified bindings I was hoping to also reduce. Thanks for explanation! 🙂