https://kotlinlang.org logo
#announcements
Title
# announcements
d

debug

07/16/2016, 4:48 PM
Copy code
@Module
class AModule {
    @Provides
    fun provideListString(): List<List<String>> {
        return listOf(listOf("Test"))
    }
}
Copy code
class TestActivity: Activity() {
    @Inject
    lateinit var listString: List<List<String>>

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
    }
}
This fails upon build with:
Copy code
Error:java.util.List<? extends java.util.List<java.lang.String>> cannot be provided without an @Provides- or @Produces-annotated method.
      java.util.List<? extends java.util.List<java.lang.String>> is injected at
          com.sample.kotlinandroidplayground.TestActivity.listString
      com.sample.kotlinandroidplayground.TestActivity is injected at
          com.sample.kotlinandroidplayground.AComponent.inject(arg0)
. Why? I think this has something to do with nested generics. Using Dagger 2.5