Skip to content

Commit b1711eb

Browse files
authored
Restore allWarningsAsErrors in main source-sets (#4336)
1 parent 2d89b24 commit b1711eb

File tree

18 files changed

+21
-22
lines changed

18 files changed

+21
-22
lines changed

buildSrc/src/main/kotlin/configure-compilation-conventions.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ configure(subprojects) {
1616
apiVersion = it
1717
versionsAreNotOverridden = false
1818
}
19-
if (isMainTaskName && versionsAreNotOverridden && !unpublished.contains(project.name)) {
19+
if (isMainTaskName && !unpublished.contains(project.name)) {
2020
allWarningsAsErrors = true
21-
freeCompilerArgs.add("-Xexplicit-api=strict")
21+
freeCompilerArgs.addAll("-Xexplicit-api=strict", "-Xdont-warn-on-error-suppression")
2222
}
2323
/* Coroutines do not interop with Java and these flags provide a significant
2424
* (i.e. close to double-digit) reduction in both bytecode and optimized dex size */

gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
version=1.10.1-SNAPSHOT
33
group=org.jetbrains.kotlinx
44
kotlin_version=2.1.0
5-
kotlin_language_version=2.1
65
# DO NOT rename this property without adapting kotlinx.train build chain:
76
atomicfu_version=0.26.1
87

kotlinx-coroutines-core/common/src/Builders.common.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@file:JvmMultifileClass
22
@file:JvmName("BuildersKt")
33
@file:OptIn(ExperimentalContracts::class)
4+
@file:Suppress("LEAKED_IN_PLACE_LAMBDA", "WRONG_INVOCATION_KIND")
45

56
package kotlinx.coroutines
67

@@ -153,7 +154,6 @@ public suspend fun <T> withContext(
153154
// FAST PATH #1 -- new context is the same as the old one
154155
if (newContext === oldContext) {
155156
val coroutine = ScopeCoroutine(newContext, uCont)
156-
@Suppress("LEAKED_IN_PLACE_LAMBDA") // Contract is preserved, invoked immediately or throws
157157
return@sc coroutine.startUndispatchedOrReturn(coroutine, block)
158158
}
159159
// FAST PATH #2 -- the new dispatcher is the same as the old one (something else changed)
@@ -162,13 +162,11 @@ public suspend fun <T> withContext(
162162
val coroutine = UndispatchedCoroutine(newContext, uCont)
163163
// There are changes in the context, so this thread needs to be updated
164164
withCoroutineContext(coroutine.context, null) {
165-
@Suppress("LEAKED_IN_PLACE_LAMBDA") // Contract is preserved, invoked immediately or throws
166165
return@sc coroutine.startUndispatchedOrReturn(coroutine, block)
167166
}
168167
}
169168
// SLOW PATH -- use new dispatcher
170169
val coroutine = DispatchedCoroutine(newContext, uCont)
171-
@Suppress("LEAKED_IN_PLACE_LAMBDA") // Contract is preserved, invoked immediately or throws
172170
block.startCoroutineCancellable(coroutine, coroutine)
173171
coroutine.getResult()
174172
}

kotlinx-coroutines-core/common/src/CoroutineScope.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@file:OptIn(ExperimentalContracts::class)
2+
@file:Suppress("LEAKED_IN_PLACE_LAMBDA", "WRONG_INVOCATION_KIND")
23

34
package kotlinx.coroutines
45

@@ -281,7 +282,6 @@ public suspend fun <R> coroutineScope(block: suspend CoroutineScope.() -> R): R
281282
}
282283
return suspendCoroutineUninterceptedOrReturn { uCont ->
283284
val coroutine = ScopeCoroutine(uCont.context, uCont)
284-
@Suppress("LEAKED_IN_PLACE_LAMBDA") // Contract is preserved, invoked immediately or throws
285285
coroutine.startUndispatchedOrReturn(coroutine, block)
286286
}
287287
}

kotlinx-coroutines-core/common/src/Supervisor.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@file:OptIn(ExperimentalContracts::class)
2-
@file:Suppress("DEPRECATION_ERROR")
2+
@file:Suppress("LEAKED_IN_PLACE_LAMBDA", "WRONG_INVOCATION_KIND")
33

44
package kotlinx.coroutines
55

@@ -53,7 +53,6 @@ public suspend fun <R> supervisorScope(block: suspend CoroutineScope.() -> R): R
5353
}
5454
return suspendCoroutineUninterceptedOrReturn { uCont ->
5555
val coroutine = SupervisorCoroutine(uCont.context, uCont)
56-
@Suppress("LEAKED_IN_PLACE_LAMBDA") // Contract is preserved, invoked immediately or throws
5756
coroutine.startUndispatchedOrReturn(coroutine, block)
5857
}
5958
}

kotlinx-coroutines-core/common/src/Timeout.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@file:OptIn(ExperimentalContracts::class)
2+
@file:Suppress("LEAKED_IN_PLACE_LAMBDA", "WRONG_INVOCATION_KIND")
23

34
package kotlinx.coroutines
45

@@ -40,7 +41,6 @@ public suspend fun <T> withTimeout(timeMillis: Long, block: suspend CoroutineSco
4041
}
4142
if (timeMillis <= 0L) throw TimeoutCancellationException("Timed out immediately")
4243
return suspendCoroutineUninterceptedOrReturn { uCont ->
43-
@Suppress("LEAKED_IN_PLACE_LAMBDA") // Contract is preserved, invoked immediately or throws
4444
setupTimeout(TimeoutCoroutine(timeMillis, uCont), block)
4545
}
4646
}

kotlinx-coroutines-core/common/src/channels/Channel.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
@file:Suppress("FunctionName")
2-
31
package kotlinx.coroutines.channels
42

53
import kotlinx.coroutines.*

kotlinx-coroutines-core/common/src/flow/Migration.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@file:JvmMultifileClass
22
@file:JvmName("FlowKt")
3-
@file:Suppress("unused", "DeprecatedCallableAddReplaceWith", "UNUSED_PARAMETER", "NO_EXPLICIT_RETURN_TYPE_IN_API_MODE")
3+
@file:Suppress("unused", "DeprecatedCallableAddReplaceWith", "UNUSED_PARAMETER")
44

55
package kotlinx.coroutines.flow
66

kotlinx-coroutines-core/common/src/internal/LockFreeLinkedList.common.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
@file:Suppress("NO_EXPLICIT_VISIBILITY_IN_API_MODE")
2-
31
package kotlinx.coroutines.internal
42

53
/** @suppress **This is unstable API and it is subject to change.** */

kotlinx-coroutines-core/common/src/internal/Synchronized.common.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@file:Suppress("LEAKED_IN_PLACE_LAMBDA", "WRONG_INVOCATION_KIND")
2+
13
package kotlinx.coroutines.internal
24

35
import kotlinx.coroutines.*
@@ -24,6 +26,5 @@ public inline fun <T> synchronized(lock: SynchronizedObject, block: () -> T): T
2426
contract {
2527
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
2628
}
27-
@Suppress("LEAKED_IN_PLACE_LAMBDA") // Contract is preserved, invoked immediately or throws
2829
return synchronizedImpl(lock, block)
2930
}

kotlinx-coroutines-core/jvm/src/Builders.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@file:JvmMultifileClass
22
@file:JvmName("BuildersKt")
33
@file:OptIn(ExperimentalContracts::class)
4+
@file:Suppress("LEAKED_IN_PLACE_LAMBDA", "WRONG_INVOCATION_KIND")
45

56
package kotlinx.coroutines
67

kotlinx-coroutines-core/jvm/src/channels/Actor.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ public fun <E> CoroutineScope.actor(
119119
return coroutine
120120
}
121121

122+
@Suppress("MULTIPLE_DEFAULTS_INHERITED_FROM_SUPERTYPES_WHEN_NO_EXPLICIT_OVERRIDE_DEPRECATION_WARNING")
122123
private open class ActorCoroutine<E>(
123124
parentContext: CoroutineContext,
124125
channel: Channel<E>,

kotlinx-coroutines-core/native/src/Builders.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
@file:OptIn(ExperimentalContracts::class, ObsoleteWorkersApi::class)
2+
@file:Suppress("LEAKED_IN_PLACE_LAMBDA", "WRONG_INVOCATION_KIND")
3+
24
package kotlinx.coroutines
35

46
import kotlinx.cinterop.*
@@ -64,7 +66,6 @@ public actual fun <T> runBlocking(context: CoroutineContext, block: suspend Coro
6466
var completed = false
6567
ThreadLocalKeepAlive.addCheck { !completed }
6668
try {
67-
@Suppress("LEAKED_IN_PLACE_LAMBDA") // Contract is preserved, invoked immediately or throws
6869
coroutine.start(CoroutineStart.DEFAULT, coroutine, block)
6970
return coroutine.joinBlocking()
7071
} finally {

kotlinx-coroutines-test/jvm/src/migration/TestCoroutineDispatcher.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@ public class TestCoroutineDispatcher(public override val scheduler: TestCoroutin
4545
private fun post(block: Runnable, context: CoroutineContext) =
4646
scheduler.registerEvent(this, 0, block, context) { false }
4747

48-
val currentTime: Long
48+
public val currentTime: Long
4949
get() = scheduler.currentTime
5050

51-
fun advanceUntilIdle(): Long {
51+
public fun advanceUntilIdle(): Long {
5252
val oldTime = scheduler.currentTime
5353
scheduler.advanceUntilIdle()
5454
return scheduler.currentTime - oldTime
5555
}
5656

57-
fun runCurrent(): Unit = scheduler.runCurrent()
57+
public fun runCurrent(): Unit = scheduler.runCurrent()
5858

59-
fun cleanupTestCoroutines() {
59+
public fun cleanupTestCoroutines() {
6060
// process any pending cancellations or completions, but don't advance time
6161
scheduler.runCurrent()
6262
if (!scheduler.isIdle(strict = false)) {

kotlinx-coroutines-test/wasmJs/src/TestBuilders.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import kotlin.js.*
66

77
public actual typealias TestResult = JsPromiseInterfaceForTesting
88

9+
@Suppress("INFERRED_TYPE_VARIABLE_INTO_POSSIBLE_EMPTY_INTERSECTION")
910
internal actual fun createTestResult(testProcedure: suspend CoroutineScope.() -> Unit): TestResult =
1011
GlobalScope.promise {
1112
testProcedure()

reactive/kotlinx-coroutines-reactive/api/kotlinx-coroutines-reactive.api

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public final class kotlinx/coroutines/reactive/FlowSubscription : kotlinx/corout
3737
public final field flow Lkotlinx/coroutines/flow/Flow;
3838
public final field subscriber Lorg/reactivestreams/Subscriber;
3939
public fun <init> (Lkotlinx/coroutines/flow/Flow;Lorg/reactivestreams/Subscriber;Lkotlin/coroutines/CoroutineContext;)V
40-
public fun cancel ()V
40+
public synthetic fun cancel ()V
4141
public fun request (J)V
4242
}
4343

reactive/kotlinx-coroutines-reactive/src/Publish.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ public class PublisherCoroutine<in T>(
316316
signalCompleted(cause, handled)
317317
}
318318

319+
@Suppress("OVERRIDE_DEPRECATION") // Remove after 2.2.0
319320
override fun cancel() {
320321
// Specification requires that after cancellation publisher stops signalling
321322
// This flag distinguishes subscription cancellation request from the job crash

reactive/kotlinx-coroutines-reactive/src/ReactiveFlow.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ public class FlowSubscription<T>(
244244
}
245245
}
246246

247+
@Deprecated("Since 1.2.0, binary compatibility with versions <= 1.1.x", level = DeprecationLevel.HIDDEN)
247248
override fun cancel() {
248249
cancellationRequested = true
249250
cancel(null)

0 commit comments

Comments
 (0)