Fix test in JDK independent way
This commit is contained in:
+1
-1
@@ -18,7 +18,7 @@ fun box(): String {
|
|||||||
if (b1.hashCode() == b2.hashCode()) return "Fail 1"
|
if (b1.hashCode() == b2.hashCode()) return "Fail 1"
|
||||||
if (b1.equals(b2)) return "Fail 2"
|
if (b1.equals(b2)) return "Fail 2"
|
||||||
|
|
||||||
val anno = C::class.java.annotations.first() as Anno
|
val anno = C::class.java.annotations.filterIsInstance<Anno>().first()
|
||||||
val c1 = C(anno)
|
val c1 = C(anno)
|
||||||
val c2 = C(anno)
|
val c2 = C(anno)
|
||||||
if (c1.hashCode() != c2.hashCode()) return "Fail 3"
|
if (c1.hashCode() != c2.hashCode()) return "Fail 3"
|
||||||
|
|||||||
+8
-7
@@ -1,7 +1,5 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
// IGNORE_BACKEND: JVM_IR
|
||||||
// IGNORE_BACKEND: JS_IR
|
// TARGET_BACKEND: JVM
|
||||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
|
||||||
// IGNORE_BACKEND: JS, NATIVE
|
|
||||||
|
|
||||||
// WITH_REFLECT
|
// WITH_REFLECT
|
||||||
// FILE: J.java
|
// FILE: J.java
|
||||||
@@ -21,14 +19,17 @@ public class J {
|
|||||||
// FILE: K.kt
|
// FILE: K.kt
|
||||||
|
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
import kotlin.reflect.KAnnotatedElement
|
||||||
|
|
||||||
annotation class Anno(val value: String)
|
annotation class Anno(val value: String)
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
assertEquals("[@Anno(value=J)]", J::class.annotations.toString())
|
assertEquals("J", getSingleAnnoAnnotation(J::class).value)
|
||||||
assertEquals("[@Anno(value=foo)]", J::foo.annotations.toString())
|
assertEquals("foo", getSingleAnnoAnnotation(J::foo).value)
|
||||||
assertEquals("[@Anno(value=bar)]", J::bar.annotations.toString())
|
assertEquals("bar", getSingleAnnoAnnotation(J::bar).value)
|
||||||
assertEquals("[@Anno(value=constructor)]", ::J.annotations.toString())
|
assertEquals("constructor", getSingleAnnoAnnotation(::J).value)
|
||||||
|
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getSingleAnnoAnnotation(annotated: KAnnotatedElement): Anno = annotated.annotations.single() as Anno
|
||||||
Reference in New Issue
Block a user