Fix codegen box tests for language version 1.4

Since API version 1.4, NullPointerException is thrown for casts of null
to any type instead of TypeCastException.
This commit is contained in:
Alexander Udalov
2020-01-20 16:55:53 +01:00
parent 6a90dc2efe
commit f48bdc1fcb
17 changed files with 115 additions and 51 deletions
@@ -17,14 +17,14 @@ fun box(): String {
try {
val (index, i) = JImpl().arrayOfNotNull().withIndex().first()
return "Fail: should throw on get()"
} catch (e: IllegalStateException) {}
} catch (e: NullPointerException) {}
try {
for ((index, i) in JImpl().arrayOfNotNull().withIndex()) {
return "Fail: should throw on get() in loop header"
}
}
catch (e: IllegalStateException) {}
catch (e: NullPointerException) {}
return "OK"
}
@@ -18,14 +18,14 @@ fun box(): String {
try {
val (index, i) = J.listOfNotNull().withIndex().first()
return "Fail: should throw on get()"
} catch (e: IllegalStateException) {}
} catch (e: NullPointerException) {}
try {
for ((index, i) in J.listOfNotNull().withIndex()) {
return "Fail: should throw on get() in loop header"
}
}
catch (e: IllegalStateException) {}
catch (e: NullPointerException) {}
return "OK"
}
@@ -18,14 +18,14 @@ fun box(): String {
try {
val (index, i) = J.iteratorOfNotNull().withIndex().next()
return "Fail: should throw on get()"
} catch (e: IllegalStateException) {}
} catch (e: NullPointerException) {}
try {
for ((index, i) in J.iteratorOfNotNull().withIndex()) {
return "Fail: should throw on get() in loop header"
}
}
catch (e: IllegalStateException) {}
catch (e: NullPointerException) {}
return "OK"
}