Skip to content

Commit 0d0424d

Browse files
committed
Optimize JobSupport -- don't extend AbstractCoroutineContextElement
this way, there is no extra key field in every job instance
1 parent c2adef5 commit 0d0424d

File tree

1 file changed

+3
-2
lines changed
  • kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental

1 file changed

+3
-2
lines changed

kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental/Job.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import kotlinx.coroutines.experimental.selects.SelectBuilder
2626
import kotlinx.coroutines.experimental.selects.SelectInstance
2727
import kotlinx.coroutines.experimental.selects.select
2828
import java.util.concurrent.Future
29-
import kotlin.coroutines.experimental.AbstractCoroutineContextElement
3029
import kotlin.coroutines.experimental.Continuation
3130
import kotlin.coroutines.experimental.CoroutineContext
3231

@@ -376,7 +375,9 @@ public object NonDisposableHandle : DisposableHandle {
376375
* @param active when `true` the job is created in _active_ state, when `false` in _new_ state. See [Job] for details.
377376
* @suppress **This is unstable API and it is subject to change.**
378377
*/
379-
public open class JobSupport(active: Boolean) : AbstractCoroutineContextElement(Job), Job {
378+
public open class JobSupport(active: Boolean) : Job {
379+
override val key: CoroutineContext.Key<*> get() = Job
380+
380381
/*
381382
=== Internal states ===
382383

0 commit comments

Comments
 (0)