https://kotlinlang.org logo
#kodein
Title
# kodein
o

omarkj

04/23/2017, 7:42 PM
Hey. I might be doing something wrong here, but I’m trying to pass in a generic provider such that the type enclosed needs to match the one enclosed to the owning class. I don’t really have the vocabulary to explain it so some actual code might help:
Copy code
val executor = Executor<TestTaskContext>(Kodein {
            bind<Bus<TestTaskContext>>() with provider { bus }
        })
This fails with
Copy code
com.github.salomonbrys.kodein.Kodein$NotFoundException: No provider found for bind<Bus<in T>>() with ? { ? }
Registered in Kodein:
        bind<Bus<in ExecutorTest.TestTaskContext>>() with provider { ExecutorTest.taskNameSerializesCorrectlyTest$bus$1 }
Which makes sense to me. I can work around this by just passing in a factory function myself (so not using Kodein) but I’m wondering if there is a way to work around this ?