5f775497e2
It might differ from the JVM package FQ name if the JvmPackageName annotation is used. This will be useful for faster indexing in the IDE and for reflection
29 lines
633 B
Kotlin
Vendored
29 lines
633 B
Kotlin
Vendored
// TARGET_BACKEND: JVM
|
|
// WITH_RUNTIME
|
|
// LANGUAGE_VERSION: 1.2
|
|
|
|
// FILE: foo.kt
|
|
|
|
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
|
@file:JvmPackageName("baz.foo.quux.bar")
|
|
package foo.bar
|
|
|
|
fun f() {}
|
|
|
|
// FILE: bar.kt
|
|
|
|
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
|
|
|
|
fun getPackageName(classFqName: String): String =
|
|
Class.forName(classFqName).getAnnotation(Metadata::class.java).pn
|
|
|
|
fun box(): String {
|
|
val bar = getPackageName("BarKt")
|
|
if (bar != "") return "Fail 1: $bar"
|
|
|
|
val foo = getPackageName("baz.foo.quux.bar.FooKt")
|
|
if (foo != "foo.bar") return "Fail 2: $foo"
|
|
|
|
return "OK"
|
|
}
|