Fix reflection-related codegen tests on JDK 9+

In JDK 9, Class.simpleName changed behavior for local/anonymous Kotlin
classes (see KT-23072), this is why we now check for both variants of
the name in tests. Also, the format of annotation arguments changed a
little, where float parameters no longer have the trailing "f", and
class literals are rendered with ".class" at the end
This commit is contained in:
Alexander Udalov
2019-01-21 19:03:08 +01:00
parent 795f9d83e1
commit 38fd2b9ed6
5 changed files with 24 additions and 14 deletions
@@ -12,7 +12,7 @@ public @interface Anno {
// FILE: test.kt
import kotlin.test.assertEquals
import kotlin.test.assertTrue
class C {
@Anno
@@ -23,7 +23,7 @@ class C {
}
fun box(): String {
assertEquals("[@Anno(value=void)]", C::f1.annotations.toString())
assertEquals("[@Anno(value=class java.lang.Void)]", C::f2.annotations.toString())
assertTrue("\\[@Anno\\(value=void(\\.class)?\\)\\]".toRegex().matches(C::f1.annotations.toString()))
assertTrue("\\[@Anno\\(value=(class )?java.lang.Void(\\.class)?\\)\\]".toRegex().matches(C::f2.annotations.toString()))
return "OK"
}