JVM IR: unmute boxInline tests on enclosing method/class

In box tests, only check that Java reflection does not crash on the
EnclosingMethod attribute generated in these classes. If it doesn't
crash, most likely it returns the value that can be read from the class
file by ASM, which is what the newly added bytecode listing tests are
checking now.
This commit is contained in:
Alexander Udalov
2020-09-01 21:52:58 +02:00
parent 985088a3f1
commit 0dea6b94c6
18 changed files with 719 additions and 63 deletions
+7 -11
View File
@@ -1,9 +1,8 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// TARGET_BACKEND: JVM
// NO_CHECK_LAMBDA_INLINING
// WITH_RUNTIME
// FILE: 1.kt
package test
inline fun test(s: () -> Unit) {
@@ -15,22 +14,19 @@ inline fun test(s: () -> Unit) {
import test.*
fun box(): String {
var encl1 = "fail";
var encl2 = "fail";
var s1 = ""
var s2 = ""
test {
{
val p = object {}
encl1 = p.javaClass.enclosingMethod.declaringClass.name
// Check that Java reflection doesn't crash. Actual values are tested in bytecodeListing/inline/enclosingInfo/.
s1 = p.javaClass.enclosingMethod.declaringClass.toString();
{
val p = object {}
encl2 = p.javaClass.enclosingMethod.declaringClass.name
val q = object {}
s2 = q.javaClass.enclosingMethod.declaringClass.toString()
}()
}()
}
if (encl1 != "_2Kt\$box\$\$inlined\$test\$lambda$1") return "fail 1: $encl1"
if (encl2 != "_2Kt\$box\$\$inlined\$test\$lambda$1$2") return "fail 2: $encl2"
return "OK"
}