amzn / kotlin-inject-anvil

Extensions for the kotlin-inject dependency injection framework
Apache License 2.0
240 stars 4 forks source link

Support contributing multibindings into `Sets` #2

Closed vRallev closed 2 months ago

vRallev commented 2 months ago

@ContributesBinding doesn't support multibindings. The annotation is already repeatable and whether a multibinding is used should be parameter, e.g.

@Inject
@ContributesBinding(boundType = Base::class)
@ContributesBinding(boundType = Base2::class, multibinding = true)
class Impl : Base, Base2 

This should generate functions like this:

@Provides
fun provideBase(impl: Impl): Base = impl

@IntoSet
@Provides
fun provideBase2(impl: Impl): Base = impl