Dagger 2.20+编译

时间:2019-01-27 13:40:11

标签: dagger

在Dagger 2.20之前,我有一个自定义绑定

我的组件是

@Subcomponent
interface GalleryComponent : AndroidInjector<GalleryController<HomeController>> {

    @Subcomponent.Builder
    abstract class Builder : AndroidInjector.Builder<GalleryController<HomeController>>()

}

模块

@Module(subcomponents = [GalleryComponent::class])
abstract class GalleryBindingModule {

    @Binds
    @IntoMap
    @ControllerKey(GalleryController::class)
    abstract fun bindGalleryControllerInjectorFactory(builder: GalleryComponent.Builder): AndroidInjector.Factory<out Controller>
}

其中

class GalleryController<T>() : BaseController() where T : Controller, T : GalleryControllerListener {


}

我要迁移到Dagger 2.21

更改模块中的代码

@Module(subcomponents = [GalleryComponent::class])
abstract class GalleryBindingModule {

    @Binds
    @IntoMap
    @ClassKey(GalleryController::class)
    abstract fun bindGalleryControllerInjectorFactory(builder: GalleryComponent.Builder): AndroidInjector.Factory<*>
}

错误

/xxx/ GalleryBindingModule.java:10: error: xxx.GalleryComponent.Builder does not implement AndroidInjector<xxx.GalleryController<T>>
        @dagger.multibindings.ClassKey(value = xxx.GalleryController.class)

我真的不怎么用新的匕首编译它。似乎文档中的信息较少

0 个答案:

没有答案