From a818a4a811b94b54b64c4fd1dbb74966127ead71 Mon Sep 17 00:00:00 2001 From: Dmitry Khalanskiy Date: Thu, 6 Feb 2020 12:36:21 +0300 Subject: [PATCH] Do not shadow ByteBuddy agent This way, it can work even with BlockHound on JDK8, which also uses ByteBuddy and thus was in conflict. Kind of solves https://github.com/Kotlin/kotlinx.coroutines/issues/1060, but since now the debugging routine depends on BlockHound, where, it seems, the same problem was not fixed, the original cause for concern probably still stands. --- gradle.properties | 2 +- kotlinx-coroutines-debug/build.gradle | 3 ++- kotlinx-coroutines-debug/src/internal/DebugProbesImpl.kt | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 6d8456a5a8..6d66a71ad7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ atomicfu_version=0.14.1 html_version=0.6.8 lincheck_version=2.5.3 dokka_version=0.9.16-rdev-2-mpp-hacks -byte_buddy_version=1.9.3 +byte_buddy_version=1.10.7 reactor_vesion=3.2.5.RELEASE reactive_streams_version=1.0.2 rxjava2_version=2.2.8 diff --git a/kotlinx-coroutines-debug/build.gradle b/kotlinx-coroutines-debug/build.gradle index 47c42afb5c..22210262a5 100644 --- a/kotlinx-coroutines-debug/build.gradle +++ b/kotlinx-coroutines-debug/build.gradle @@ -21,9 +21,10 @@ configurations { dependencies { compileOnly "junit:junit:$junit_version" shadowDeps "net.bytebuddy:byte-buddy:$byte_buddy_version" - shadowDeps "net.bytebuddy:byte-buddy-agent:$byte_buddy_version" + compile "net.bytebuddy:byte-buddy-agent:$byte_buddy_version" compile 'io.projectreactor.tools:blockhound:1.0.1.BUILD-SNAPSHOT' compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + runtime "net.java.dev.jna:jna:5.5.0" } jar { diff --git a/kotlinx-coroutines-debug/src/internal/DebugProbesImpl.kt b/kotlinx-coroutines-debug/src/internal/DebugProbesImpl.kt index c34214112e..a777b79604 100644 --- a/kotlinx-coroutines-debug/src/internal/DebugProbesImpl.kt +++ b/kotlinx-coroutines-debug/src/internal/DebugProbesImpl.kt @@ -47,7 +47,7 @@ internal object DebugProbesImpl { public fun install() { if (++installations > 1) return - ByteBuddyAgent.install() + ByteBuddyAgent.install(ByteBuddyAgent.AttachmentProvider.ForEmulatedAttachment.INSTANCE) val cl = Class.forName("kotlin.coroutines.jvm.internal.DebugProbesKt") val cl2 = Class.forName("kotlinx.coroutines.debug.DebugProbesKt")