Files
kotlin-fork/compiler/testData/codegen/box/jvmName/loadJvmName.kt
T
Alexander Udalov bf3419c3bd Introduce OptionalExpectation for annotations missing on some platforms
This commits adds a new annotation OptionalExpectation to the standard
library, which is experimental. To enable its usage, either pass
'-Xuse-experimental=kotlin.ExperimentalMultiplatform' as a compiler
argument, or '-Xuse-experimental=kotlin.Experimental' and also annotate
each usage with `@UseExperimental(ExperimentalMultiplatform::class)`

 #KT-18882 Fixed
2018-05-24 13:14:51 +02:00

14 lines
372 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// WITH_RUNTIME
@JvmName("bar")
fun foo() {}
fun getJvmName(): JvmName? =
Class.forName("LoadJvmNameKt").declaredMethods.single { it.name == "bar" }.getAnnotation(JvmName::class.java)
fun box(): String {
// JvmName is binary-retained and should not be accessible via reflection
return if (getJvmName() == null) "OK" else "Fail"
}