Skip to content

Commit 87f2faa

Browse files
committed
Fix compiler warnings
Fixes Kotlin#348
1 parent e0b6db0 commit 87f2faa

File tree

12 files changed

+13
-14
lines changed

12 files changed

+13
-14
lines changed

common/kotlinx-coroutines-core-common/src/main/kotlin/kotlinx/coroutines/experimental/CoroutineContext.common.kt

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package kotlinx.coroutines.experimental
1818

1919
import kotlin.coroutines.experimental.*
2020

21-
@Suppress("EXPECTED_DECLARATION_WITH_DEFAULT_PARAMETER")
2221
public expect fun newCoroutineContext(context: CoroutineContext, parent: Job? = null): CoroutineContext
2322

2423
@Suppress("PropertyName")

common/kotlinx-coroutines-core-common/src/test/kotlin/kotlinx/coroutines/experimental/TestBase.common.kt

-2
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,11 @@ public expect open class TestBase constructor() {
2020
public val isStressTest: Boolean
2121
public val stressTestMultiplier: Int
2222

23-
@Suppress("EXPECTED_DECLARATION_WITH_DEFAULT_PARAMETER")
2423
public fun error(message: Any, cause: Throwable? = null): Nothing
2524
public fun expect(index: Int)
2625
public fun expectUnreached()
2726
public fun finish(index: Int)
2827

29-
@Suppress("EXPECTED_DECLARATION_WITH_DEFAULT_PARAMETER")
3028
public fun runTest(
3129
expected: ((Throwable) -> Boolean)? = null,
3230
unhandled: List<(Throwable) -> Boolean> = emptyList(),

common/kotlinx-coroutines-core-common/src/test/kotlin/kotlinx/coroutines/experimental/WithTimeoutOrNullTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class WithTimeoutOrNullTest : TestBase() {
177177
expected = { it is TestException }
178178
) {
179179
expect(1)
180-
val result = withTimeoutOrNull(100) {
180+
withTimeoutOrNull(100) {
181181
expect(2)
182182
try {
183183
delay(1000)

common/kotlinx-coroutines-core-common/src/test/kotlin/kotlinx/coroutines/experimental/WithTimeoutTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class WithTimeoutTest : TestBase() {
147147
expected = { it is CancellationException }
148148
) {
149149
expect(1)
150-
val result = withTimeout(100) {
150+
withTimeout(100) {
151151
expect(2)
152152
try {
153153
delay(1000)

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ package kotlinx.coroutines.experimental
1818

1919
import kotlinx.coroutines.experimental.timeunit.TimeUnit
2020
import java.util.concurrent.*
21-
import java.util.concurrent.atomic.AtomicInteger
22-
import kotlin.coroutines.experimental.CoroutineContext
21+
import java.util.concurrent.atomic.*
22+
import kotlin.coroutines.experimental.*
2323

2424
/**
2525
* Represents common pool of shared threads as coroutine dispatcher for compute-intensive tasks.

core/kotlinx-coroutines-core/src/test/kotlin/kotlinx/coroutines/experimental/AsyncJvmTest.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ class AsyncJvmTest : TestBase() {
2424
@Test
2525
fun testAsyncWithFinally() = runTest {
2626
expect(1)
27-
val d = async<String>(coroutineContext) {
27+
28+
@Suppress("UNREACHABLE_CODE")
29+
val d = async(coroutineContext) {
2830
expect(3)
2931
try {
3032
yield() // to main, will cancel

core/kotlinx-coroutines-core/src/test/kotlin/kotlinx/coroutines/experimental/TestBaseTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class TestBaseTest : TestBase() {
2222
@Test
2323
fun testThreadsShutdown() {
2424
val SHUTDOWN_TIMEOUT = 1_000L
25-
repeat(1000 * stressTestMultiplier) { i ->
25+
repeat(1000 * stressTestMultiplier) { _ ->
2626
CommonPool.usePrivatePool()
2727
val threadsBefore = currentThreads()
2828
runBlocking {

core/kotlinx-coroutines-core/src/test/kotlin/kotlinx/coroutines/experimental/channels/ActorTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class ActorTest(private val capacity: Int) : TestBase() {
106106
expect(2)
107107
require(element!! == 42)
108108
try {
109-
val next = channel.receiveOrNull()
109+
channel.receiveOrNull()
110110
} catch (e: IOException) {
111111
expect(3)
112112
}

core/kotlinx-coroutines-core/src/test/kotlin/kotlinx/coroutines/experimental/channels/BroadcastChannelMultiReceiveStressTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class BroadcastChannelMultiReceiveStressTest(
9191
printProgress()
9292
}
9393
// wait
94-
repeat(nSeconds) { sec ->
94+
repeat(nSeconds) { _ ->
9595
delay(1000)
9696
printProgress()
9797
}

core/kotlinx-coroutines-core/src/test/kotlin/kotlinx/coroutines/experimental/internal/LockFreeListLinearizabilityTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class LockFreeListLinearizabilityTest : TestBase() {
5353
@Operation
5454
fun removeFirstOrPeekIfNotSame(@Param(name = "value") value: Int): Int? {
5555
val node = q.removeFirstIfIsInstanceOfOrPeekIf<Node> { !it.isSame(value) } ?: return null
56-
return (node as Node).value
56+
return node.value
5757
}
5858

5959
fun Any.isSame(value: Int) = this is Node && this.value == value

core/kotlinx-coroutines-io/src/test/kotlin/kotlinx/coroutines/experimental/io/ByteBufferChannelTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ class ByteBufferChannelTest : TestBase() {
819819
return launch(context = DefaultDispatcher + CoroutineName(name), parent = coroutineContext[Job]) {
820820
block()
821821
}.apply {
822-
invokeOnCompletion(true) { t ->
822+
invokeOnCompletion( onCancelling = true) { t ->
823823
if (t != null) ch.cancel(t)
824824
}
825825
}

integration/kotlinx-coroutines-jdk8/src/main/kotlin/kotlinx/coroutines/experimental/future/Future.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public suspend fun <T> CompletionStage<T>.await(): T {
166166
// fast path when CompletableFuture is already done (does not suspend)
167167
if (this is Future<*> && isDone()) {
168168
try {
169-
@Suppress("UNCHECKED")
169+
@Suppress("UNCHECKED_CAST")
170170
return get() as T
171171
} catch (e: ExecutionException) {
172172
throw e.cause ?: e // unwrap original cause from ExecutionException

0 commit comments

Comments
 (0)