Use isJvmInterface in JVM back-end instead of isInterface

To support const vals and proper initialization order for companions of
annotations (since 1.3+) as well as interfaces

 #KT-16962 Fixed
This commit is contained in:
Alexander Udalov
2018-01-23 18:55:13 +01:00
parent a46a2b9b1c
commit 543db380d2
12 changed files with 92 additions and 17 deletions
@@ -0,0 +1,19 @@
// !LANGUAGE: +NestedClassesInAnnotations
// WITH_RUNTIME
// TARGET_BACKEND: JVM
// FILE: Foo.java
@Anno(Anno.CONST)
public class Foo {}
// FILE: Anno.kt
annotation class Anno(val value: Int) {
companion object {
const val CONST = 42
}
}
fun box(): String =
if ((Foo::class.java.annotations.single() as Anno).value == 42) "OK" else "Fail"