File tree 3 files changed +32
-4
lines changed
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.
5
5
The format is based on [ Keep a Changelog] ( http://keepachangelog.com/en/1.0.0/ )
6
6
and this project adheres to [ Semantic Versioning] ( http://semver.org/spec/v2.0.0.html ) .
7
7
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
+
8
36
## [ 0.5.1] 2022-07-05
9
37
10
38
### Fixed
Original file line number Diff line number Diff line change @@ -387,12 +387,12 @@ class MyClass(fooCreator: () -> Foo) {
387
387
}
388
388
```
389
389
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 .
392
392
393
393
```kotlin
394
394
@Inject
395
- class Foo (bar : Bar , arg1 : String , arg2 : String )
395
+ class Foo (bar : Bar , @Assisted arg1 : String , @Assisted arg2 : String )
396
396
397
397
@Inject
398
398
class MyClass (fooCreator : (arg1: String , arg2: String ) -> Foo ) {
Original file line number Diff line number Diff line change 1
1
[versions ]
2
- kotlin-inject = " 0.5.2-SNAPSHOT "
2
+ kotlin-inject = " 0.6.0 "
3
3
kotlin = " 1.5.31"
4
4
ksp = " 1.5.31-1.0.1"
5
5
kotlinpoet = " 1.10.1"
You can’t perform that action at this time.
0 commit comments