@@ -5,9 +5,68 @@ 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.2] 2023-08-28
9
+
10
+ ### Changed
11
+
12
+ - Updated kotlin to 1.9.0
13
+ - If a dependency's scope is not found on the component providing it, a better error message is given.
14
+ - Adding a ` @Provides ` annotation on an abstract ` fun ` or ` val ` will now warn that it has no effect.
15
+ - When overriding a method the parent is checked to see if it has a ` @Provides ` annotation. This makes the example in
16
+ the README actually work:
17
+ ``` kotlin
18
+ @NetworkScope abstract class NetworkComponent {
19
+ @NetworkScope @Provides abstract fun api (): Api
20
+ }
21
+ @Component abstract class RealNetworkComponent : NetworkComponent () {
22
+ // This is now treated as a @Provides even if not annotated directly
23
+ override fun api (): Api = RealApi ()
24
+ }
25
+ ```
26
+
27
+ ### Fixed
28
+
29
+ - Typealiases are treated as separate types in multibinding. This is consistent with other
30
+ uses of typealiases.
31
+
32
+ For example:
33
+ ``` kotlin
34
+ typealias MyString = String
35
+
36
+ @Component abstract class MyComponent {
37
+ abstract val stringItems: Set <String >
38
+ abstract val myStringItems: Set <MyString >
39
+
40
+ @Provides @IntoSet fun stringValue1 (): String = " string"
41
+
42
+ @Provides @IntoSet fun stringValue2 (): MyString = " myString"
43
+ }
44
+ ```
45
+ ` stringItems ` will contain ` {"string"} ` and ` myStringItems ` will contain ` {"myString"} ` .
46
+ - Lambda types now work in set multibindings.
47
+ ``` kotlin
48
+ @Component abstract class MyComponent {
49
+ abstract val lambdaSet: Set < () -> String >
50
+
51
+ @Provides @IntoSet fun lambda1 (): () -> String = { " one" }
52
+
53
+ @Provides @IntoSet fun lambda2 (): () -> String = { " two" }
54
+ }
55
+ ```
56
+ - Assisted injection no longer works with scopes or cycles. These two cases would over-cache the instance, ignoring the
57
+ assisted arguments. They now throw an error instead.
58
+ ``` kotlin
59
+ // now throws cycle error when providing
60
+ @Inject class AssistedCycle (val factory : (Int ) -> AssistedCycle , @Assisted val arg : Int )
61
+ // now throws error when providing
62
+ @MyScope @Inject class AssistedScoped (@Assisted val arg : Int )
63
+ ```
64
+ - Fixed edge case where accessing a parent scoped dependency from a lazy cycle generated invalid code.
65
+
8
66
## [ 0.6.1] 2023-02-11
9
67
10
68
### Fixed
69
+
11
70
- Fixed code generation issues with assisted injection.
12
71
13
72
## [ 0.6.0] 2022-12-21
@@ -32,6 +91,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
32
91
```
33
92
34
93
### Fixed
94
+
35
95
- ` @Inject ` annotations being ignored if used through a typealias, ex:
36
96
``` kotlin
37
97
typealias MyInject = Inject
@@ -78,7 +138,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
78
138
```
79
139
Cannot find an @Inject constructor or provider for: Bar
80
140
```
81
- In other words a parent component can no longer depend on a dependency provided by a child component. Not only does
141
+ In other words a parent component can no longer depend on a dependency provided by a child component. Not only does
82
142
this lead to confusing graphs, but it can lead to memory leaks if the parent component lives longer than the child and
83
143
ends holding on to that child dependency.
84
144
@@ -102,7 +162,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
102
162
arg would shadow the outer arg that was attempted to be used.
103
163
- Improved the error message for scoped provides in unscoped component.
104
164
- Fixed printing of an inner type to include the outer class. i.e. You will now get ` Parent.Child ` in error messages
105
- instead of just ` Child ` which can make it easier to find the location of the error.
165
+ instead of just ` Child ` which can make it easier to find the location of the error.
106
166
107
167
## [ 0.4.1] 2022-01-01
108
168
@@ -114,7 +174,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
114
174
### Fixed
115
175
116
176
- Fixes conflicting declarations when scoped ` @Provides ` functions returned the same type with different generic args.
117
- - Fixes default parameter handling with lambda or lazy values.
177
+ - Fixes default parameter handling with lambda or lazy values.
118
178
- Fixes to kotlin native implementation that should make it more usable across threads.
119
179
Note: the new memory model limitation is still present, but you can use https://github.com/touchlab/Stately to wrap
120
180
the access when using the legacy memory model.
@@ -135,7 +195,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
135
195
the [ sample project] ( https://github.com/evant/kotlin-inject-samples/tree/main/multiplatform/echo ) .
136
196
137
197
Note: components are thread-safe, however you will run into issues actually using them from other threads unless you
138
- enable the [ new memory model] ( https://blog.jetbrains.com/kotlin/2021/08/try-the-new-kotlin-native-memory-manager-development-preview/ ) .
198
+ enable
199
+ the [ new memory model] ( https://blog.jetbrains.com/kotlin/2021/08/try-the-new-kotlin-native-memory-manager-development-preview/ ) .
139
200
- Added support for default args when injecting. If the type is present in the graph, it'll be injected, otherwise the
140
201
default will be used.
141
202
0 commit comments