Platform compatibility & Genericity
Kodein-DI 7.1.0 is built upon and compatible with Kotlin 1.4.0.
Also, it requires at least JDK 1.8, for JVM projects.
7.0.0, a new type system has been designed and included to Kodein-DI.
Thus, it appears to the developer that there is no more obvious differences between platforms, you no longer have to choose between
7.0.0, Kodein-DI is using the
generic version of the type system, meaning you should be able to bind generics easily for Kotlin/Multiplatform projects.
So, whatever platform you are targeting,
bind<List<Int>>() will represent two different bindings.
di.instance<List<Int>>() will yield two different list.
Since 7.0, Kodein-DI can use
However, you should be aware that under the hood, this new type system uses the new function
typeOf() from Kotlin, for every platforms, except for the JVM that still have it’s own
Meaning that the JVM counterpart of the type system makes a heavy use of reflection, so it’s less optimized.
Yes, #perfmatters. However, the humble opinion of the author is that:
Therefore, please make sure that, using the erased version is right for your use case, before blindly using it ;). Do profile your code!
Even if by default Kodein-DI uses a