streetsofboston
06/19/2020, 7:04 PMsingle { SomeClass.Factory(...) }
single { SomeOtherClass.Factory(...) }
(on Kotlin Multi Platform), I get this error:
java.lang.IllegalStateException: InstanceRegistry already contains index 'Factory'
How can I make Koin use the qualified class name instead of just the inner class’ name?
It is probably of this code in the jvm target of Koin:
actual fun className(kClass: KClass<*>): String = kClass.java.simpleName
Why is simpleName used and not the full-name?kenkyee
06/20/2020, 11:39 AMstreetsofboston
06/20/2020, 1:45 PMT in single<T>(...) { ... } is reified, and if this T has the value SomeType.SomeInnerType , then Koin will index/cache this single binding with the string ”SomeInnerType" , not the fully-qualified class name ("package.SomeType.SomeInnerType")
This means you can't create another Koin binding for SomeInnerType or OtherClass.SomeInnerType, etc. Koin will generate a runtime error that the SomeInnerType type is bound more than once.