Rewrite assertions so that they are checked only in debug mode
* Make sure assertions are absent on native and JS
* Only print full toString for Job in debug mode
diff --git a/kotlinx-coroutines-core/common/src/channels/ArrayChannel.kt b/kotlinx-coroutines-core/common/src/channels/ArrayChannel.kt
index 01afc21..688125d 100644
--- a/kotlinx-coroutines-core/common/src/channels/ArrayChannel.kt
+++ b/kotlinx-coroutines-core/common/src/channels/ArrayChannel.kt
@@ -1,9 +1,10 @@
/*
- * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
+ * Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
package kotlinx.coroutines.channels
+import kotlinx.coroutines.*
import kotlinx.coroutines.internal.*
import kotlinx.coroutines.selects.*
import kotlin.jvm.*
@@ -94,7 +95,7 @@
this.size = size // restore size
receive = offerOp.result
token = offerOp.resumeToken
- check(token != null)
+ assert { token != null }
return@withLock
}
failure === OFFER_FAILED -> break@loop // cannot offer -> Ok to queue to buffer
@@ -180,7 +181,7 @@
failure == null -> { // polled successfully
send = pollOp.result
token = pollOp.resumeToken
- check(token != null)
+ assert { token != null }
replacement = send!!.pollResult
break@loop
}