diff --git a/kotlinx-coroutines-core/jvm/src/debug/AgentPremain.kt b/kotlinx-coroutines-core/jvm/src/debug/AgentPremain.kt index fb5c5b1b06..85c6257dd6 100644 --- a/kotlinx-coroutines-core/jvm/src/debug/AgentPremain.kt +++ b/kotlinx-coroutines-core/jvm/src/debug/AgentPremain.kt @@ -21,16 +21,11 @@ import java.security.* @IgnoreJRERequirement // Never touched on Android internal object AgentPremain { - private val enableCreationStackTraces = runCatching { - System.getProperty("kotlinx.coroutines.debug.enable.creation.stack.trace")?.toBoolean() - }.getOrNull() ?: DebugProbesImpl.enableCreationStackTraces - @JvmStatic @Suppress("UNUSED_PARAMETER") fun premain(args: String?, instrumentation: Instrumentation) { AgentInstallationType.isInstalledStatically = true instrumentation.addTransformer(DebugProbesTransformer) - DebugProbesImpl.enableCreationStackTraces = enableCreationStackTraces DebugProbesImpl.install() installSignalHandler() } diff --git a/kotlinx-coroutines-core/jvm/src/debug/internal/DebugProbesImpl.kt b/kotlinx-coroutines-core/jvm/src/debug/internal/DebugProbesImpl.kt index a7432ef658..b0e3b54f6c 100644 --- a/kotlinx-coroutines-core/jvm/src/debug/internal/DebugProbesImpl.kt +++ b/kotlinx-coroutines-core/jvm/src/debug/internal/DebugProbesImpl.kt @@ -40,7 +40,9 @@ internal object DebugProbesImpl { private val sequenceNumber = atomic(0L) public var sanitizeStackTraces: Boolean = true - public var enableCreationStackTraces: Boolean = true + public var enableCreationStackTraces: Boolean = runCatching { + System.getProperty("kotlinx.coroutines.debug.enable.creation.stack.trace")?.toBoolean() + }.getOrNull() ?: true /* * Substitute for service loader, DI between core and debug modules.