Aligh test data with JDK 15 reflection output

This commit is contained in:
Mikhael Bogdanov
2021-02-05 14:12:38 +01:00
parent 21e9f67322
commit 3dff225b98
6 changed files with 18 additions and 13 deletions
@@ -23,7 +23,7 @@ class C {
}
fun box(): String {
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()))
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"
}
@@ -3,11 +3,12 @@
// WITH_REFLECT
import kotlin.test.assertEquals
import kotlin.test.assertTrue
enum class E { X, Y, Z }
fun box(): String {
assertEquals(11, E::class.members.size)
assertTrue(E::class.members.size in 11..12, "" + E::class.members.size)
assertEquals("Y", E::name.call(E.Y))
assertEquals(2, E::ordinal.call(E.Z))
return "OK"
@@ -19,10 +19,12 @@ interface A<T, Y : B<T>> {
fun box(): String {
val defaultImpls = Class.forName("test.A\$DefaultImpls")
val declaredMethod = defaultImpls.getDeclaredMethod("p", A::class.java, Any::class.java)
if (declaredMethod.toGenericString() != "public static <T_I1,Y,T,L> T test.A\$DefaultImpls.p(test.A<T_I1, Y>,T)") return "fail 1: ${declaredMethod.toGenericString()}"
if (declaredMethod.toGenericString() != "public static <T_I1,Y,T,L> T test.A\$DefaultImpls.p(test.A<T_I1, Y>,T)" &&
declaredMethod.toGenericString() != "public static <T_I1,Y extends test.B<T_I1>,T,L> T test.A\$DefaultImpls.p(test.A<T_I1, Y>,T)") return "fail 1: ${declaredMethod.toGenericString()}"
val declaredProperty = defaultImpls.getDeclaredMethod("getZ", A::class.java, Any::class.java)
if (declaredProperty.toGenericString() != "public static <T_I1,Y,T> T test.A\$DefaultImpls.getZ(test.A<T_I1, Y>,T)") return "fail 2: ${declaredProperty.toGenericString()}"
if (declaredProperty.toGenericString() != "public static <T_I1,Y,T> T test.A\$DefaultImpls.getZ(test.A<T_I1, Y>,T)" &&
declaredProperty.toGenericString() != "public static <T_I1,Y extends test.B<T_I1>,T> T test.A\$DefaultImpls.getZ(test.A<T_I1, Y>,T)") return "fail 2: ${declaredProperty.toGenericString()}"
return "OK"
}