Fix codegen & bytecode tests after unifying exceptions in JVM backend
See KT-22275 for details
This commit is contained in:
Vendored
+1
-1
@@ -75,7 +75,7 @@ fun box(): String {
|
||||
// and returning defaultValue if null was received seems incorrect here
|
||||
mm.getOrDefault("abc", null)
|
||||
return "fail 7"
|
||||
} catch (e: java.lang.IllegalArgumentException) {
|
||||
} catch (e: java.lang.NullPointerException) {
|
||||
// Parameter specified as non-null is null
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ fun box(): String {
|
||||
try {
|
||||
test3<Int>()
|
||||
}
|
||||
catch(e: TypeCastException) {
|
||||
catch(e: NullPointerException) {
|
||||
result3 = "OK"
|
||||
}
|
||||
if (result3 != "OK") return "fail: test3"
|
||||
|
||||
@@ -35,7 +35,7 @@ fun box(): String {
|
||||
suspendHere()
|
||||
}
|
||||
return "fail 1"
|
||||
} catch (e: kotlin.KotlinNullPointerException) {
|
||||
} catch (e: NullPointerException) {
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -54,7 +54,7 @@ fun box(): String {
|
||||
result = "fail 5"
|
||||
}
|
||||
return "fail 6"
|
||||
} catch (e: kotlin.KotlinNullPointerException) {
|
||||
} catch (e: NullPointerException) {
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@@ -13,7 +13,7 @@ fun box(): String {
|
||||
try {
|
||||
val b: String = a[0]
|
||||
return "Fail: an exception should be thrown"
|
||||
} catch (e: IllegalStateException) {
|
||||
} catch (e: NullPointerException) {
|
||||
val st = (e as java.lang.Throwable).getStackTrace()
|
||||
if (st.size < 5) {
|
||||
return "Fail: very small stack trace, should at least have current function and JUnit reflective calls: ${Arrays.toString(st)}"
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ private operator fun J.component2() = 2
|
||||
fun use(x: Any) {}
|
||||
|
||||
fun box(): String {
|
||||
assertFailsWith<IllegalArgumentException> {
|
||||
assertFailsWith<NullPointerException> {
|
||||
val (a, b) = J.j()
|
||||
}
|
||||
if (!component1Evaluated) return "component1 should be evaluated"
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ fun f(x: String) = "Fail 1"
|
||||
fun box(): String {
|
||||
return try {
|
||||
f(J().s())
|
||||
} catch (e: IllegalStateException) {
|
||||
} catch (e: NullPointerException) {
|
||||
if (e.message == "J().s() must not be null")
|
||||
"OK"
|
||||
else
|
||||
|
||||
+2
-2
@@ -8,11 +8,11 @@ public class Test {
|
||||
try {
|
||||
ExtensionKt.foo(null);
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
catch (NullPointerException e) {
|
||||
try {
|
||||
ExtensionKt.getBar(null);
|
||||
}
|
||||
catch (IllegalArgumentException f) {
|
||||
catch (NullPointerException f) {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -20,18 +20,18 @@ public class Test {
|
||||
args[i] = null;
|
||||
try {
|
||||
f.invoke(args);
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (NullPointerException e) {
|
||||
// OK
|
||||
continue;
|
||||
} catch (Throwable e) {
|
||||
throw new AssertionError(
|
||||
"Incorrect exception (IllegalArgumentException expected): " + e.getClass().getName() + ", parameter index = " + i,
|
||||
"Incorrect exception (NullPointerException expected): " + e.getClass().getName() + ", parameter index = " + i,
|
||||
e
|
||||
);
|
||||
} finally {
|
||||
args[i] = o;
|
||||
}
|
||||
throw new AssertionError("IllegalArgumentException expected, but nothing was thrown, parameter index = " + i);
|
||||
throw new AssertionError("NullPointerException expected, but nothing was thrown, parameter index = " + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import kotlin.test.*
|
||||
operator fun A.inc() = A()
|
||||
|
||||
fun box(): String {
|
||||
assertFailsWith<IllegalArgumentException> {
|
||||
assertFailsWith<NullPointerException> {
|
||||
var aNull = A.n()
|
||||
aNull++
|
||||
}
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import kotlin.test.*
|
||||
private operator fun A.inc() = A()
|
||||
|
||||
fun box(): String {
|
||||
assertFailsWith<IllegalArgumentException> {
|
||||
assertFailsWith<NullPointerException> {
|
||||
var aNull = A.n()
|
||||
aNull++
|
||||
}
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ public class F {
|
||||
inline fun <T, U> expectAssertion(f: () -> (T) -> U): Unit? {
|
||||
try {
|
||||
F.passNull(f())
|
||||
} catch (e: IllegalArgumentException) {
|
||||
} catch (e: NullPointerException) {
|
||||
return Unit
|
||||
}
|
||||
return null
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ class C : I
|
||||
fun box() = try {
|
||||
B.f()
|
||||
"FAIL"
|
||||
} catch (e: IllegalArgumentException) {
|
||||
} catch (e: NullPointerException) {
|
||||
"OK"
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import kotlin.test.*
|
||||
fun String.extension() {}
|
||||
|
||||
fun box(): String {
|
||||
assertFailsWith<IllegalStateException> { J.s().extension() }
|
||||
assertFailsWith<NullPointerException> { J.s().extension() }
|
||||
return "OK"
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import kotlin.test.*
|
||||
inline fun String.extension() {}
|
||||
|
||||
fun box(): String {
|
||||
assertFailsWith<IllegalStateException> {
|
||||
assertFailsWith<NullPointerException> {
|
||||
J.s().extension()
|
||||
}
|
||||
return "OK"
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ class C {
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
assertFailsWith<IllegalStateException> { C().test() }
|
||||
assertFailsWith<NullPointerException> { C().test() }
|
||||
return "OK"
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ class C {
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
assertFailsWith<IllegalStateException> {
|
||||
assertFailsWith<NullPointerException> {
|
||||
C().test()
|
||||
}
|
||||
return "OK"
|
||||
|
||||
+2
-2
@@ -17,11 +17,11 @@ fun box(): String {
|
||||
try {
|
||||
Test.callFoo()
|
||||
return "Fail 1"
|
||||
} catch (e : IllegalArgumentException) {
|
||||
} catch (e: NullPointerException) {
|
||||
if (e.message != "Parameter specified as non-null is null: method A.foo, parameter s") {
|
||||
return "Fail 2 (message: ${e.message})"
|
||||
}
|
||||
} catch (e : Throwable) {
|
||||
} catch (e: Throwable) {
|
||||
return "Fail 3 (exception class: ${e::class.simpleName})"
|
||||
}
|
||||
return "OK"
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ fun f(x: String) = "Fail 1"
|
||||
fun box(): String {
|
||||
return try {
|
||||
f(J.s())
|
||||
} catch (e: IllegalStateException) {
|
||||
} catch (e: NullPointerException) {
|
||||
if (e.message == "J.s() must not be null" || e.message == "s() must not be null")
|
||||
"OK"
|
||||
else
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import kotlin.test.*
|
||||
operator fun A.inc() = A()
|
||||
|
||||
fun box(): String {
|
||||
assertFailsWith<IllegalArgumentException> {
|
||||
assertFailsWith<NullPointerException> {
|
||||
var aNull = A.n()
|
||||
aNull++
|
||||
}
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import kotlin.test.*
|
||||
fun String.extension() {}
|
||||
|
||||
fun box(): String {
|
||||
assertFailsWith<IllegalArgumentException> { J.s().extension() }
|
||||
assertFailsWith<NullPointerException> { J.s().extension() }
|
||||
return "OK"
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ fun box(): String {
|
||||
val a: Any? = null
|
||||
a as Array<String>
|
||||
}
|
||||
catch (e: TypeCastException) {
|
||||
catch (e: NullPointerException) {
|
||||
if (e.message != "null cannot be cast to non-null type kotlin.Array<kotlin.String>") {
|
||||
return "Fail 1: $e"
|
||||
}
|
||||
@@ -22,7 +22,7 @@ fun box(): String {
|
||||
val x: String? = null
|
||||
x as String
|
||||
}
|
||||
catch (e: TypeCastException) {
|
||||
catch (e: NullPointerException) {
|
||||
if (e.message != "null cannot be cast to non-null type kotlin.String") {
|
||||
return "Fail 2: $e"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user