diff --git a/compiler/testData/codegen/box/dataClasses/typeParameterWithNonTrivialBound.kt b/compiler/testData/codegen/box/dataClasses/typeParameterWithNonTrivialBound.kt index c7577664ba1..c977a758222 100644 --- a/compiler/testData/codegen/box/dataClasses/typeParameterWithNonTrivialBound.kt +++ b/compiler/testData/codegen/box/dataClasses/typeParameterWithNonTrivialBound.kt @@ -18,7 +18,7 @@ fun box(): String { if (b1.hashCode() == b2.hashCode()) return "Fail 1" if (b1.equals(b2)) return "Fail 2" - val anno = C::class.java.annotations.first() as Anno + val anno = C::class.java.annotations.filterIsInstance().first() val c1 = C(anno) val c2 = C(anno) if (c1.hashCode() != c2.hashCode()) return "Fail 3" diff --git a/compiler/testData/codegen/box/reflection/annotations/annotationsOnJavaMembers.kt b/compiler/testData/codegen/box/reflection/annotations/annotationsOnJavaMembers.kt index 85ca38a6a4e..912c22b98c3 100644 --- a/compiler/testData/codegen/box/reflection/annotations/annotationsOnJavaMembers.kt +++ b/compiler/testData/codegen/box/reflection/annotations/annotationsOnJavaMembers.kt @@ -1,7 +1,5 @@ // IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS_IR -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS, NATIVE +// TARGET_BACKEND: JVM // WITH_REFLECT // FILE: J.java @@ -21,14 +19,17 @@ public class J { // FILE: K.kt import kotlin.test.assertEquals +import kotlin.reflect.KAnnotatedElement annotation class Anno(val value: String) fun box(): String { - assertEquals("[@Anno(value=J)]", J::class.annotations.toString()) - assertEquals("[@Anno(value=foo)]", J::foo.annotations.toString()) - assertEquals("[@Anno(value=bar)]", J::bar.annotations.toString()) - assertEquals("[@Anno(value=constructor)]", ::J.annotations.toString()) + assertEquals("J", getSingleAnnoAnnotation(J::class).value) + assertEquals("foo", getSingleAnnoAnnotation(J::foo).value) + assertEquals("bar", getSingleAnnoAnnotation(J::bar).value) + assertEquals("constructor", getSingleAnnoAnnotation(::J).value) return "OK" } + +fun getSingleAnnoAnnotation(annotated: KAnnotatedElement): Anno = annotated.annotations.single() as Anno \ No newline at end of file