Skip to content

Commit

Permalink
Hide declarations in internal package
Browse files Browse the repository at this point in the history
  • Loading branch information
elizarov committed Apr 26, 2018
1 parent 0af5824 commit 15cd96a
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -935,28 +935,28 @@ public abstract class AbstractChannel<E> : AbstractSendChannel<E>(), Channel<E>
}

/** @suppress **This is unstable API and it is subject to change.** */
@JvmField val OFFER_SUCCESS: Any = Symbol("OFFER_SUCCESS")
@JvmField internal val OFFER_SUCCESS: Any = Symbol("OFFER_SUCCESS")

/** @suppress **This is unstable API and it is subject to change.** */
@JvmField val OFFER_FAILED: Any = Symbol("OFFER_FAILED")
@JvmField internal val OFFER_FAILED: Any = Symbol("OFFER_FAILED")

/** @suppress **This is unstable API and it is subject to change.** */
@JvmField val POLL_FAILED: Any = Symbol("POLL_FAILED")
@JvmField internal val POLL_FAILED: Any = Symbol("POLL_FAILED")

/** @suppress **This is unstable API and it is subject to change.** */
@JvmField val ENQUEUE_FAILED: Any = Symbol("ENQUEUE_FAILED")
@JvmField internal val ENQUEUE_FAILED: Any = Symbol("ENQUEUE_FAILED")

/** @suppress **This is unstable API and it is subject to change.** */
@JvmField val SELECT_STARTED: Any = Symbol("SELECT_STARTED")
@JvmField internal val SELECT_STARTED: Any = Symbol("SELECT_STARTED")

/** @suppress **This is unstable API and it is subject to change.** */
@JvmField val NULL_VALUE: Any = Symbol("NULL_VALUE")
@JvmField internal val NULL_VALUE: Any = Symbol("NULL_VALUE")

/** @suppress **This is unstable API and it is subject to change.** */
@JvmField val CLOSE_RESUMED: Any = Symbol("CLOSE_RESUMED")
@JvmField internal val CLOSE_RESUMED: Any = Symbol("CLOSE_RESUMED")

/** @suppress **This is unstable API and it is subject to change.** */
@JvmField val SEND_RESUMED = Symbol("SEND_RESUMED")
@JvmField internal val SEND_RESUMED = Symbol("SEND_RESUMED")

/**
* Represents sending waiter in the queue.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ package kotlinx.coroutines.experimental.internal
/**
* Cross-platform array copy. Overlaps of source and destination are not supported
*/
expect fun <E> arraycopy(source: Array<E>, srcPos: Int, destination: Array<E?>, destinationStart: Int, length: Int)
internal expect fun <E> arraycopy(source: Array<E>, srcPos: Int, destination: Array<E?>, destinationStart: Int, length: Int)
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package kotlinx.coroutines.experimental.internal

expect interface Closeable {
/**
* Closeable entity.
* @suppress **Deprecated**
*/
@Deprecated("No replacement, see specific use")
public expect interface Closeable {
@Deprecated("No replacement, see specific code")
fun close()
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ package kotlinx.coroutines.experimental.internal
*
* Note that this alias is intentionally not named as CopyOnWriteList to avoid accidental misusage outside of ArrayBroadcastChannel
*/
typealias SubscribersList<E> = MutableList<E>
internal typealias SubscribersList<E> = MutableList<E>

expect fun <E> subscriberList(): SubscribersList<E>
internal expect fun <E> subscriberList(): SubscribersList<E>

expect class ReentrantLock() {
internal expect class ReentrantLock() {
fun tryLock(): Boolean
fun unlock(): Unit
}

expect inline fun <T> ReentrantLock.withLock(action: () -> T): T
internal expect inline fun <T> ReentrantLock.withLock(action: () -> T): T
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public expect open class AddLastDesc<T : LockFreeLinkedListNode>(
override fun finishOnSuccess(affected: LockFreeLinkedListNode, next: LockFreeLinkedListNode)
}

/** @suppress **This is unstable API and it is subject to change.** */
public expect open class RemoveFirstDesc<T>(queue: LockFreeLinkedListNode): AbstractAtomicDesc {
val queue: LockFreeLinkedListNode
public val result: T
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ package kotlinx.coroutines.experimental.internal
*
* @suppress **This is unstable API and it is subject to change.**
*/
public class Symbol(val symbol: String) {
internal class Symbol(val symbol: String) {
override fun toString(): String = symbol
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package kotlinx.coroutines.experimental.internal

actual fun <E> arraycopy(source: Array<E>, srcPos: Int, destination: Array<E?>, destinationStart: Int, length: Int){
internal actual fun <E> arraycopy(source: Array<E>, srcPos: Int, destination: Array<E?>, destinationStart: Int, length: Int){
System.arraycopy(source, srcPos, destination, destinationStart, length)
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
package kotlinx.coroutines.experimental.internal

actual typealias Closeable = java.io.Closeable
/**
* Closeable entity.
* @suppress **Deprecated**
*/
@Deprecated("No replacement, see specific use")
public actual typealias Closeable = java.io.Closeable
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package kotlinx.coroutines.experimental.internal
import java.util.concurrent.*
import kotlin.concurrent.withLock as withLockJvm

actual fun <E> subscriberList(): MutableList<E> = CopyOnWriteArrayList<E>()
internal actual fun <E> subscriberList(): MutableList<E> = CopyOnWriteArrayList<E>()

actual typealias ReentrantLock = java.util.concurrent.locks.ReentrantLock
@Suppress("ACTUAL_WITHOUT_EXPECT")
internal actual typealias ReentrantLock = java.util.concurrent.locks.ReentrantLock

actual inline fun <T> ReentrantLock.withLock(action: () -> T) = this.withLockJvm(action)
internal actual inline fun <T> ReentrantLock.withLock(action: () -> T) = this.withLockJvm(action)
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package kotlinx.coroutines.experimental.internal


actual fun <E> arraycopy(source: Array<E>, srcPos: Int, destination: Array<E?>, destinationStart: Int, length: Int) {
internal actual fun <E> arraycopy(source: Array<E>, srcPos: Int, destination: Array<E?>, destinationStart: Int, length: Int) {
var destinationIndex = destinationStart
for (sourceIndex in srcPos until srcPos + length) {
destination[destinationIndex++] = source[sourceIndex]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package kotlinx.coroutines.experimental.internal

actual interface Closeable {
actual fun close()
/**
* Closeable entity.
* @suppress **Deprecated**
*/
@Deprecated("No replacement, see specific use")
public actual interface Closeable {
public actual fun close()
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package kotlinx.coroutines.experimental.internal

actual typealias ReentrantLock = NoOpLock
internal actual typealias ReentrantLock = NoOpLock

actual inline fun <T> ReentrantLock.withLock(action: () -> T) = action()
internal actual inline fun <T> ReentrantLock.withLock(action: () -> T) = action()

public class NoOpLock {
internal class NoOpLock {
fun tryLock() = true
fun unlock(): Unit {}
}

actual fun <E> subscriberList(): MutableList<E> = ArrayList()
internal actual fun <E> subscriberList(): MutableList<E> = ArrayList()
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public actual open class AddLastDesc<T : Node> actual constructor(
protected actual override fun finishOnSuccess(affected: LockFreeLinkedListNode, next: LockFreeLinkedListNode) = Unit
}

/** @suppress **This is unstable API and it is subject to change.** */
public actual open class RemoveFirstDesc<T> actual constructor(
actual val queue: LockFreeLinkedListNode
) : AbstractAtomicDesc() {
Expand Down

0 comments on commit 15cd96a

Please sign in to comment.