Commit 6bad5fc
authored
Stabilize Channel.invokeOnClose (#3682)
* Stabilize Channel.invokeOnClose
CompletionHandler is not used deliberately, as its contract requires some additional refinement along with `onCancelling` handler stabilization. Note that replacing functional type with the very same typealias is backwards-compatible in the current state of linkage, so we are not giving up any future opportunities.
Also, fix behavioural mismatch: `CancellationException` is supplied (and always has been) to `invokeOnClose` when a channel was cancelled normally instead of `null` as documentation stated.
This behaviour is aligned with other cancellation handlers and also allows the handler to distinguish whether the channel was closed or cancelled.
Fixes #33581 parent 6427e0e commit 6bad5fc
File tree
2 files changed
+59
-13
lines changed- kotlinx-coroutines-core/common
- src/channels
- test/channels
2 files changed
+59
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
109 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
110 | 111 | | |
111 | | - | |
| 112 | + | |
112 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
113 | 119 | | |
114 | | - | |
| 120 | + | |
115 | 121 | | |
116 | 122 | | |
| 123 | + | |
117 | 124 | | |
118 | 125 | | |
119 | | - | |
120 | | - | |
121 | | - | |
| 126 | + | |
| 127 | + | |
122 | 128 | | |
123 | | - | |
| 129 | + | |
124 | 130 | | |
125 | 131 | | |
126 | 132 | | |
127 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
128 | 136 | | |
129 | | - | |
| 137 | + | |
130 | 138 | | |
131 | 139 | | |
132 | 140 | | |
133 | 141 | | |
134 | | - | |
135 | 142 | | |
136 | 143 | | |
137 | 144 | | |
| |||
388 | 395 | | |
389 | 396 | | |
390 | 397 | | |
391 | | - | |
| 398 | + | |
392 | 399 | | |
393 | 400 | | |
394 | 401 | | |
| |||
Lines changed: 40 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
88 | 127 | | |
89 | 128 | | |
90 | 129 | | |
| |||
124 | 163 | | |
125 | 164 | | |
126 | 165 | | |
127 | | - | |
| 166 | + | |
128 | 167 | | |
129 | 168 | | |
130 | 169 | | |
| |||
0 commit comments