From 8a65c3243dd16d72587899f466267a65b4400f61 Mon Sep 17 00:00:00 2001 From: Vsevolod Tolstopyatov Date: Fri, 16 Oct 2020 17:50:13 +0300 Subject: [PATCH] Remove workaround for KT-42671 that triggers test failures from IDEA and access properties in a safe manner from agent premain instead --- kotlinx-coroutines-core/build.gradle | 4 +--- kotlinx-coroutines-core/jvm/src/debug/AgentPremain.kt | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/kotlinx-coroutines-core/build.gradle b/kotlinx-coroutines-core/build.gradle index 29784bffcf..f98f6a529c 100644 --- a/kotlinx-coroutines-core/build.gradle +++ b/kotlinx-coroutines-core/build.gradle @@ -177,9 +177,7 @@ jvmTest { minHeapSize = '1g' maxHeapSize = '1g' enableAssertions = true - if (!Idea.active) { // Workaround for KT-42671 - systemProperty 'java.security.manager', 'kotlinx.coroutines.TestSecurityManager' - } + systemProperty 'java.security.manager', 'kotlinx.coroutines.TestSecurityManager' // 'stress' is required to be able to run all subpackage tests like ":jvmTests --tests "*channels*" -Pstress=true" if (!Idea.active && rootProject.properties['stress'] == null) { exclude '**/*StressTest.*' diff --git a/kotlinx-coroutines-core/jvm/src/debug/AgentPremain.kt b/kotlinx-coroutines-core/jvm/src/debug/AgentPremain.kt index df10501bac..5a1a1ed1b7 100644 --- a/kotlinx-coroutines-core/jvm/src/debug/AgentPremain.kt +++ b/kotlinx-coroutines-core/jvm/src/debug/AgentPremain.kt @@ -21,9 +21,9 @@ internal object AgentPremain { public var isInstalledStatically = false - private val enableCreationStackTraces = + private val enableCreationStackTraces = runCatching { System.getProperty("kotlinx.coroutines.debug.enable.creation.stack.trace")?.toBoolean() - ?: DebugProbesImpl.enableCreationStackTraces + }.getOrNull() ?: DebugProbesImpl.enableCreationStackTraces @JvmStatic public fun premain(args: String?, instrumentation: Instrumentation) {