Files
kotlin-fork/compiler/testData/codegen/bytecodeListing/jvmStatic/jvmStaticPrivate.kt
T
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00

36 lines
1011 B
Kotlin
Vendored

// WITH_STDLIB
// For a private @JvmStatic function `f` in `A.Companion`, we generate:
// 1) private instance method `f` in `A.Companion`, with the actual implementation;
// 2) public static method `access$f` in `A.Companion` which calls `A.Companion.f`;
// 3) private static method `f` in `A` which calls `A.Companion.access$f`.
// (which is basically the same as all @JvmStatic companion functions, except that we also need an accessor here.)
//
// This might seem like an overkill, but there are actually some use cases, namely private static helpers for JNI (see KT-46181).
class A {
companion object {
@JvmStatic
private fun f(p: Int) {}
@JvmStatic
private val x = ""
private var xx: String
@JvmStatic get() = ""
@JvmStatic set(value) {}
}
}
object O {
@JvmStatic
private fun g(q: Int) {}
@JvmStatic
private val y = ""
private var yy: String
@JvmStatic get() = ""
@JvmStatic set(value) {}
}