@@ -24,7 +24,6 @@ import kotlinx.coroutines.experimental.internal.OpDescriptor
2424import kotlinx.coroutines.experimental.internal.unwrap
2525import kotlinx.coroutines.experimental.intrinsics.startCoroutineUndispatched
2626import kotlinx.coroutines.experimental.selects.SelectClause0
27- import kotlinx.coroutines.experimental.selects.SelectClause1
2827import kotlinx.coroutines.experimental.selects.SelectInstance
2928import kotlinx.coroutines.experimental.selects.select
3029import java.util.concurrent.Future
@@ -525,8 +524,8 @@ public actual object NonDisposableHandle : DisposableHandle {
525524 * @param active when `true` the job is created in _active_ state, when `false` in _new_ state. See [Job] for details.
526525 * @suppress **This is unstable API and it is subject to change.**
527526 */
528- internal open class JobSupport (active : Boolean ) : Job, SelectClause0 {
529- override val key: CoroutineContext .Key <* > get() = Job
527+ internal actual open class JobSupport actual constructor (active : Boolean ) : Job, SelectClause0 {
528+ actual final override val key: CoroutineContext .Key <* > get() = Job
530529
531530 /*
532531 === Internal states ===
@@ -598,7 +597,7 @@ internal open class JobSupport(active: Boolean) : Job, SelectClause0 {
598597 * It shall be invoked at most once after construction after all other initialization.
599598 * @suppress **This is unstable API and it is subject to change.**
600599 */
601- internal fun initParentJobInternal (parent : Job ? ) {
600+ internal actual fun initParentJobInternal (parent : Job ? ) {
602601 check(parentHandle == null )
603602 if (parent == null ) {
604603 parentHandle = NonDisposableHandle
@@ -637,14 +636,14 @@ internal open class JobSupport(active: Boolean) : Job, SelectClause0 {
637636 }
638637 }
639638
640- public final override val isActive: Boolean get() {
639+ public actual final override val isActive: Boolean get() {
641640 val state = this .state
642641 return state is Incomplete && state.isActive
643642 }
644643
645- public final override val isCompleted: Boolean get() = state !is Incomplete
644+ public actual final override val isCompleted: Boolean get() = state !is Incomplete
646645
647- public final override val isCancelled: Boolean get() {
646+ public actual final override val isCancelled: Boolean get() {
648647 val state = this .state
649648 return state is Cancelled || (state is Finishing && state.cancelled != null )
650649 }
@@ -741,7 +740,7 @@ internal open class JobSupport(active: Boolean) : Job, SelectClause0 {
741740 private fun notifyCancellation (list : NodeList , cause : Throwable ? ) =
742741 notifyHandlers<JobCancellationNode <* >>(list, cause)
743742
744- public final override fun start (): Boolean {
743+ public actual final override fun start (): Boolean {
745744 loopOnState { state ->
746745 when (startInternal(state)) {
747746 FALSE -> return false
@@ -775,9 +774,9 @@ internal open class JobSupport(active: Boolean) : Job, SelectClause0 {
775774 * Override to provide the actual [start] action.
776775 * This function is invoked exactly once when non-active coroutine is [started][start].
777776 */
778- internal open fun onStartInternal () {}
777+ internal actual open fun onStartInternal () {}
779778
780- public final override fun getCancellationException (): CancellationException {
779+ public actual final override fun getCancellationException (): CancellationException {
781780 val state = this .state
782781 return when {
783782 state is Finishing && state.cancelled != null ->
@@ -822,7 +821,7 @@ internal open class JobSupport(active: Boolean) : Job, SelectClause0 {
822821 public final override fun invokeOnCompletion (onCancelling_ : Boolean , handler : CompletionHandler ): DisposableHandle =
823822 invokeOnCompletion(onCancelling = onCancelling_, invokeImmediately = true , handler = handler)
824823
825- public final override fun invokeOnCompletion (
824+ public actual final override fun invokeOnCompletion (
826825 onCancelling : Boolean ,
827826 invokeImmediately : Boolean ,
828827 handler : CompletionHandler
@@ -888,7 +887,7 @@ internal open class JobSupport(active: Boolean) : Job, SelectClause0 {
888887 _state .compareAndSet(state, list)
889888 }
890889
891- public final override suspend fun join () {
890+ public actual final override suspend fun join () {
892891 if (! joinInternal()) { // fast-path no wait
893892 return suspendCoroutineOrReturn { cont ->
894893 cont.context.checkCompletion()
@@ -960,7 +959,7 @@ internal open class JobSupport(active: Boolean) : Job, SelectClause0 {
960959 */
961960 internal open val onCancelMode: Int get() = ON_CANCEL_MAKE_CANCELLING
962961
963- public override fun cancel (cause : Throwable ? ): Boolean = when (onCancelMode) {
962+ public actual override fun cancel (cause : Throwable ? ): Boolean = when (onCancelMode) {
964963 ON_CANCEL_MAKE_CANCELLED -> makeCancelled(cause)
965964 ON_CANCEL_MAKE_CANCELLING -> makeCancelling(cause)
966965 ON_CANCEL_MAKE_COMPLETING -> makeCompletingOnCancel(cause)
@@ -1045,7 +1044,7 @@ internal open class JobSupport(active: Boolean) : Job, SelectClause0 {
10451044 * @throws IllegalStateException if job is already complete or completing
10461045 * @suppress **This is unstable API and it is subject to change.**
10471046 */
1048- internal fun makeCompletingOnce (proposedUpdate : Any? , mode : Int ): Boolean =
1047+ internal actual fun makeCompletingOnce (proposedUpdate : Any? , mode : Int ): Boolean =
10491048 when (makeCompletingInternal(proposedUpdate, mode)) {
10501049 COMPLETING_COMPLETED -> true
10511050 COMPLETING_WAITING_CHILDREN -> false
@@ -1128,7 +1127,7 @@ internal open class JobSupport(active: Boolean) : Job, SelectClause0 {
11281127 }
11291128 }
11301129
1131- public final override val children: Sequence <Job > get() = buildSequence {
1130+ public actual final override val children: Sequence <Job > get() = buildSequence {
11321131 val state = this @JobSupport.state
11331132 when (state) {
11341133 is Child -> yield (state.childJob)
@@ -1139,7 +1138,7 @@ internal open class JobSupport(active: Boolean) : Job, SelectClause0 {
11391138 }
11401139
11411140 @Suppress(" OverridingDeprecatedMember" )
1142- public final override fun attachChild (child : Job ): DisposableHandle =
1141+ public actual final override fun attachChild (child : Job ): DisposableHandle =
11431142 invokeOnCompletion(onCancelling = true , handler = Child (this , child))
11441143
11451144 @Suppress(" OverridingDeprecatedMember" )
@@ -1150,8 +1149,9 @@ internal open class JobSupport(active: Boolean) : Job, SelectClause0 {
11501149 /* *
11511150 * Override to process any exceptions that were encountered while invoking completion handlers
11521151 * installed via [invokeOnCompletion].
1152+ * @suppress **This is unstable API and it is subject to change.**
11531153 */
1154- internal open fun handleException (exception : Throwable ) {
1154+ internal actual open fun handleException (exception : Throwable ) {
11551155 throw exception
11561156 }
11571157
@@ -1162,23 +1162,23 @@ internal open class JobSupport(active: Boolean) : Job, SelectClause0 {
11621162 * null when it has completed normally.
11631163 * @suppress **This is unstable API and it is subject to change.**
11641164 */
1165- internal open fun onCancellationInternal (exceptionally : CompletedExceptionally ? ) {}
1165+ internal actual open fun onCancellationInternal (exceptionally : CompletedExceptionally ? ) {}
11661166
11671167 /* *
11681168 * Override for post-completion actions that need to do something with the state.
11691169 * @param mode completion mode.
11701170 * @suppress **This is unstable API and it is subject to change.**
11711171 */
1172- internal open fun afterCompletion (state : Any? , mode : Int ) {}
1172+ internal actual open fun afterCompletion (state : Any? , mode : Int ) {}
11731173
11741174 // for nicer debugging
1175- override fun toString (): String =
1175+ public override fun toString (): String =
11761176 " ${nameString()} {${stateString()} }@$hexAddress "
11771177
11781178 /* *
11791179 * @suppress **This is unstable API and it is subject to change.**
11801180 */
1181- internal open fun nameString (): String = this ::class .java.simpleName
1181+ internal actual open fun nameString (): String = this ::class .java.simpleName
11821182
11831183 private fun stateString (): String {
11841184 val state = this .state
0 commit comments