Fix codegen & bytecode tests after unifying exceptions in JVM backend
See KT-22275 for details
This commit is contained in:
+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
|
||||
|
||||
Reference in New Issue
Block a user