kotlin-inject v0.4.1 Release Notes
Release Date: 2022-01-01 // over 2 years ago-
๐ Changed
- ๐ Improved generated code formatting.
- โ Removed explicit retention annotation to get rid of kotlin js warnings.
๐ Fixed
- ๐ Fixes conflicting declarations when scoped
@Provides
functions returned the same type with different generic args. - ๐ Fixes default parameter handling with lambda or lazy values.
- ๐ Fixes to kotlin native implementation that should make it more usable across threads. Note: the new memory model limitation is still present, but you can use https://github.com/touchlab/Stately to wrap the access when using the legacy memory model.
Previous changes from v0.4.0
-
๐ Changed
- โก๏ธ Updated kotlin to 1.5.31
- โก๏ธ Updated ksp to 1.5.31-1.0.1
- Several improvements to code generation which often means less code is generated.
โ Added
- ๐ Multiple rounds handling: This includes support for using types generated by other ksp processors. As a side effect there is better error reporting for unresolved types.
- ๐ Support for multiplatform/native. Check out the sample project.
Note: components are thread-safe, however you will run into issues actually using them from other threads unless you enable the new memory model.
- โ Added support for default args when injecting. If the type is present in the graph, it'll be injected, otherwise the default will be used.
@Inject class MyClass(val dep: Dep = Dep("default")) @Component abstract ComponentWithDep { abstract val myClass: MyClass @Provides fun dep(): Dep = Dep("injected") } @Component abstract ComponentWithoutDep { abstract val myClass: MyClass } ComponentWithDep::class.create().myClass.dep // Dep("injected") ComponentWithoutDep::class.create().myClass.dep // Dep("default")