Skip to content

Commit b1711eb

Browse files
authored
Restore allWarningsAsErrors in main source-sets (Kotlin#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
}

0 commit comments

Comments
 (0)