Skip to content

Commit ebe41ab

Browse files
committed
fix Kotlin#3648 added Ability to set DebugProbes.enableCreationStackTraces using system property
1 parent 0238247 commit ebe41ab

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

kotlinx-coroutines-core/jvm/src/debug/AgentPremain.kt

-5
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,11 @@ import java.security.*
2121
@IgnoreJRERequirement // Never touched on Android
2222
internal object AgentPremain {
2323

24-
private val enableCreationStackTraces = runCatching {
25-
System.getProperty("kotlinx.coroutines.debug.enable.creation.stack.trace")?.toBoolean()
26-
}.getOrNull() ?: DebugProbesImpl.enableCreationStackTraces
27-
2824
@JvmStatic
2925
@Suppress("UNUSED_PARAMETER")
3026
fun premain(args: String?, instrumentation: Instrumentation) {
3127
AgentInstallationType.isInstalledStatically = true
3228
instrumentation.addTransformer(DebugProbesTransformer)
33-
DebugProbesImpl.enableCreationStackTraces = enableCreationStackTraces
3429
DebugProbesImpl.install()
3530
installSignalHandler()
3631
}

kotlinx-coroutines-core/jvm/src/debug/internal/DebugProbesImpl.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ internal object DebugProbesImpl {
4040
private val sequenceNumber = atomic(0L)
4141

4242
public var sanitizeStackTraces: Boolean = true
43-
public var enableCreationStackTraces: Boolean = true
43+
public var enableCreationStackTraces: Boolean = runCatching {
44+
System.getProperty("kotlinx.coroutines.debug.enable.creation.stack.trace")?.toBoolean()
45+
}.getOrNull() ?: true
4446

4547
/*
4648
* Substitute for service loader, DI between core and debug modules.

0 commit comments

Comments
 (0)