Skip to content

Commit 9eaa0ae

Browse files
committed
Add compileOnly android annotations and suppress lint for agent premain
Fixes #2004
1 parent 32feba8 commit 9eaa0ae

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

kotlinx-coroutines-core/build.gradle

+4
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ compileKotlinMetadata {
5555
}
5656

5757
kotlin.sourceSets {
58+
jvm.dependencies {
59+
compileOnly "com.google.android:annotations:4.1.1.4"
60+
}
61+
5862
jvmTest.dependencies {
5963
api "org.jetbrains.kotlinx:lincheck:$lincheck_version"
6064
api "org.jetbrains.kotlinx:kotlinx-knit-test:$knit_version"

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

+6
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,14 @@ import sun.misc.*
99
import java.lang.instrument.*
1010
import java.lang.instrument.ClassFileTransformer
1111
import java.security.*
12+
import android.annotation.*
1213

14+
/*
15+
* This class is loaded if and only if kotlinx-coroutines-core was used as -javaagent argument,
16+
* but Android complains anyway (java.lang.instrument.*), so we suppress all lint checks here
17+
*/
1318
@Suppress("unused")
19+
@SuppressLint("all")
1420
internal object AgentPremain {
1521

1622
public var isInstalledStatically = false

0 commit comments

Comments
 (0)