Skip to content

Commit

Permalink
Add compileOnly android annotations and suppress lint for agent premain
Browse files Browse the repository at this point in the history
Fixes #2004
  • Loading branch information
qwwdfsad committed May 12, 2020
1 parent 32feba8 commit 9eaa0ae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions kotlinx-coroutines-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ compileKotlinMetadata {
}

kotlin.sourceSets {
jvm.dependencies {
compileOnly "com.google.android:annotations:4.1.1.4"
}

jvmTest.dependencies {
api "org.jetbrains.kotlinx:lincheck:$lincheck_version"
api "org.jetbrains.kotlinx:kotlinx-knit-test:$knit_version"
Expand Down
6 changes: 6 additions & 0 deletions kotlinx-coroutines-core/jvm/src/debug/AgentPremain.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ import sun.misc.*
import java.lang.instrument.*
import java.lang.instrument.ClassFileTransformer
import java.security.*
import android.annotation.*

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

public var isInstalledStatically = false
Expand Down

0 comments on commit 9eaa0ae

Please sign in to comment.