File tree Expand file tree Collapse file tree 3 files changed +32
-4
lines changed
Expand file tree Collapse file tree 3 files changed +32
-4
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,34 @@ All notable changes to this project will be documented in this file.
55The format is based on [ Keep a Changelog] ( http://keepachangelog.com/en/1.0.0/ )
66and this project adheres to [ Semantic Versioning] ( http://semver.org/spec/v2.0.0.html ) .
77
8+ ## [ 0.6.0] 2202-12-21
9+
10+ ### Changed
11+
12+ - Added the ability to explicitly mark assisted injection parameters with an ` @Assisted ` annotation. Not providing them
13+ will currently warn which will become an error in the future. This allows better documentation on which params are
14+ injected and which ones are provided by the caller. It also allows more flexibility for parameter ordering, you can
15+ put the assisted params at the start instead of at the end if you so choose.
16+
17+ For example, if you have:
18+
19+ ``` kotlin
20+ @Inject class AssistedClass (arg1 : One , arg2 : Two , arg3 : Three )
21+ @Inject Usage (createAssistedClass: (Two , Three ) -> AssistedClass )
22+ ```
23+
24+ you should update it to:
25+ ``` kotlin
26+ @Inject class AssistedClass (arg1 : One , @Assisted arg2 : Two , @Assisted arg3 : Three )
27+ ```
28+
29+ ### Fixed
30+ - ` @Inject ` annotations being ignored if used through a typealias, ex:
31+ ``` kotlin
32+ typealias MyInject = Inject
33+ @MyInject class MyClassToInject
34+ ```
35+
836## [ 0.5.1] 2022-07-05
937
1038### Fixed
Original file line number Diff line number Diff line change @@ -387,12 +387,12 @@ class MyClass(fooCreator: () -> Foo) {
387387}
388388```
389389
390- If you define args, you can use these to assist the creation of the dependency. These are passed in as the _last_
391- arguments to the dependency .
390+ If you define args, you can use these to assist the creation of the dependency. To do so, mark these args with the
391+ `@Assisted` annotation. The function should take the same number of assisted args in the same order .
392392
393393```kotlin
394394@Inject
395- class Foo (bar : Bar , arg1 : String , arg2 : String )
395+ class Foo (bar : Bar , @Assisted arg1 : String , @Assisted arg2 : String )
396396
397397@Inject
398398class MyClass (fooCreator : (arg1: String , arg2: String ) -> Foo ) {
Original file line number Diff line number Diff line change 11[versions ]
2- kotlin-inject = " 0.5.2-SNAPSHOT "
2+ kotlin-inject = " 0.6.0 "
33kotlin = " 1.5.31"
44ksp = " 1.5.31-1.0.1"
55kotlinpoet = " 1.10.1"
You can’t perform that action at this time.
0 commit comments