Fix codegen & bytecode tests after unifying exceptions in JVM backend
See KT-22275 for details
This commit is contained in:
@@ -30,7 +30,7 @@ fun box(): String {
|
||||
try {
|
||||
if (jClass.minus0().compareTo(jClass.null0()) != -2) return "fail 3"
|
||||
return "fail: exception expected";
|
||||
} catch (e: IllegalStateException) {
|
||||
} catch (e: NullPointerException) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ fun box(): String {
|
||||
}
|
||||
})
|
||||
}.run()
|
||||
} catch (e: IllegalArgumentException) {
|
||||
} catch (e: NullPointerException) {
|
||||
return "OK"
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -1,15 +1,15 @@
|
||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.DISABLE_PARAM_ASSERTIONS
|
||||
// FILE: callAssertions.kt
|
||||
|
||||
class AssertionChecker(val illegalStateExpected: Boolean) {
|
||||
class AssertionChecker(val nullPointerExceptionExpected: Boolean) {
|
||||
operator fun invoke(name: String, f: () -> Any) {
|
||||
try {
|
||||
f()
|
||||
} catch (e: IllegalStateException) {
|
||||
if (!illegalStateExpected) throw AssertionError("Unexpected IllegalStateException on calling $name")
|
||||
} catch (e: NullPointerException) {
|
||||
if (!nullPointerExceptionExpected) throw AssertionError("Unexpected NullPointerException on calling $name")
|
||||
return
|
||||
}
|
||||
if (illegalStateExpected) throw AssertionError("IllegalStateException expected on calling $name")
|
||||
if (nullPointerExceptionExpected) throw AssertionError("NullPointerException expected on calling $name")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ fun box(): String {
|
||||
DelegateFrom().foo()
|
||||
return "Fail: should have been an exception"
|
||||
}
|
||||
catch(e: IllegalStateException) {
|
||||
catch(e: NullPointerException) {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -11,10 +11,10 @@ public abstract class C<Type> {
|
||||
public static void runTest(C a) {
|
||||
try {
|
||||
a.doTest(null);
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (NullPointerException e) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Fail: IllegalArgumentException expected");
|
||||
throw new AssertionError("Fail: NullPointerException expected");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -19,13 +19,13 @@ fun box(): String {
|
||||
foo(baz() ?: RightElvisOperand.foo())
|
||||
return "Fail: should have been an exception in `foo(baz() ?: RightElvisOperand.foo())`"
|
||||
}
|
||||
catch(e: IllegalStateException) {}
|
||||
catch(e: NullPointerException) {}
|
||||
|
||||
try {
|
||||
bar()
|
||||
return "Fail: should have been an exception in `bar()`"
|
||||
}
|
||||
catch(e: IllegalStateException) {
|
||||
catch(e: NullPointerException) {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ fun box(): String {
|
||||
try {
|
||||
test(JavaClass().test())
|
||||
}
|
||||
catch (e: IllegalStateException) {
|
||||
catch (e: NullPointerException) {
|
||||
return "OK"
|
||||
}
|
||||
return "fail"
|
||||
|
||||
Reference in New Issue
Block a user