Files
kotlin-fork/compiler/testData/compileKotlinAgainstKotlin/jvmNames.kt
T
Mads Ager 51f726be9b JVM_IR: Fix check for whether classes are from Java.
This allows us to not generate redundant immutable collection
stubs. The code to generate the immutable collection stubs does
not deal well with thinking that all external declarations
come from Java.
2019-12-23 14:24:48 +01:00

49 lines
761 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// FILE: A.kt
package lib
@JvmName("bar")
fun foo() = "foo"
var v: Int = 1
@JvmName("vget")
get
@JvmName("vset")
set
fun consumeInt(x: Int) {}
open class A {
val OK: String = "OK"
@JvmName("OK") get
@JvmName("g")
fun <T> f(x: T, y: Int = 1) = x
}
annotation class Anno(@get:JvmName("uglyJvmName") val value: String)
// FILE: B.kt
import lib.*
class B : A()
@Anno("OK")
fun annotated() {}
fun box(): String {
foo()
v = 1
consumeInt(v)
val annoValue = (::annotated.annotations.single() as Anno).value
if (annoValue != "OK") return "Fail annotation value: $annoValue"
val b = B()
if (b.f("OK") != "OK") return "Fail call of annotated method"
return A().OK
}