From 5c5635ce20a1d98317f63ba8271102320323b3fa Mon Sep 17 00:00:00 2001 From: Mikhail Zarechenskiy Date: Mon, 20 Jan 2020 13:51:11 +0300 Subject: [PATCH] Fix codegen & bytecode tests after unifying exceptions in JVM backend See KT-22275 for details --- .../mapGetOrDefault/typeSafeBridgeNotNullAny.kt | 2 +- compiler/testData/codegen/box/casts/asWithGeneric.kt | 2 +- compiler/testData/codegen/box/coroutines/illegalState.kt | 4 ++-- .../box/fullJdk/platformTypeAssertionStackTrace.kt | 2 +- ...entWithNullabilityAssertionOnExtensionReceiver_lv12.kt | 2 +- .../box/javaInterop/notNullAssertions/errorMessage.kt | 2 +- .../notNullAssertions/extensionReceiverParameter.kt | 4 ++-- .../javaInterop/notNullAssertions/functionWithBigArity.kt | 6 +++--- .../incWithNullabilityAssertionOnExtensionReceiver.kt | 2 +- ...bilityAssertionOnExtensionReceiverInPrivateOperator.kt | 2 +- .../box/javaInterop/notNullAssertions/localEntities.kt | 2 +- .../notNullAssertions/nonNullableTypeParameter.kt | 2 +- .../nullabilityAssertionOnExtensionReceiver.kt | 2 +- .../nullabilityAssertionOnInlineFunExtensionReceiver.kt | 2 +- .../nullabilityAssertionOnMemberExtensionReceiver.kt | 2 +- ...ullabilityAssertionOnPrivateMemberExtensionReceiver.kt | 2 +- .../notNullAssertions/paramAssertionMessage.kt | 4 ++-- .../notNullAssertions/staticCallErrorMessage.kt | 2 +- ...incWithNullabilityAssertionOnExtensionReceiver_lv11.kt | 2 +- .../nullabilityAssertionOnExtensionReceiver_lv11.kt | 2 +- .../testData/codegen/box/regressions/typeCastException.kt | 4 ++-- .../codegen/boxAgainstJava/ieee754/explicitCompareCall.kt | 2 +- .../testData/codegen/boxAgainstJava/inline/kt19910.kt | 2 +- .../boxAgainstJava/notNullAssertions/callAssertions.kt | 8 ++++---- .../boxAgainstJava/notNullAssertions/delegation.kt | 2 +- .../notNullAssertions/doGenerateParamAssertions.kt | 4 ++-- .../boxAgainstJava/notNullAssertions/rightElvisOperand.kt | 4 ++-- .../codegen/boxAgainstJava/platformTypes/kt14989.kt | 2 +- .../assertionsForParametersOfInlineClassTypes.kt | 4 ++-- .../bytecodeText/notNullAssertions/arrayListGet.kt | 8 ++++---- .../notNullAssertions/assertionForNotNullCaptured.kt | 4 ++-- .../notNullAssertions/assertionForNotNullTypeParam.kt | 4 ++-- .../notNullAssertions/javaMultipleSubstitutions.kt | 8 ++++---- .../expressionValueIsNotNullTwice.kt | 4 ++-- 34 files changed, 55 insertions(+), 55 deletions(-) diff --git a/compiler/testData/codegen/box/builtinStubMethods/mapGetOrDefault/typeSafeBridgeNotNullAny.kt b/compiler/testData/codegen/box/builtinStubMethods/mapGetOrDefault/typeSafeBridgeNotNullAny.kt index 70efdbb5243..a1ba239ddd3 100644 --- a/compiler/testData/codegen/box/builtinStubMethods/mapGetOrDefault/typeSafeBridgeNotNullAny.kt +++ b/compiler/testData/codegen/box/builtinStubMethods/mapGetOrDefault/typeSafeBridgeNotNullAny.kt @@ -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 } diff --git a/compiler/testData/codegen/box/casts/asWithGeneric.kt b/compiler/testData/codegen/box/casts/asWithGeneric.kt index 5f59c9c06ca..e74a206c5b6 100644 --- a/compiler/testData/codegen/box/casts/asWithGeneric.kt +++ b/compiler/testData/codegen/box/casts/asWithGeneric.kt @@ -19,7 +19,7 @@ fun box(): String { try { test3() } - catch(e: TypeCastException) { + catch(e: NullPointerException) { result3 = "OK" } if (result3 != "OK") return "fail: test3" diff --git a/compiler/testData/codegen/box/coroutines/illegalState.kt b/compiler/testData/codegen/box/coroutines/illegalState.kt index c19d3185605..8023a9fef4d 100644 --- a/compiler/testData/codegen/box/coroutines/illegalState.kt +++ b/compiler/testData/codegen/box/coroutines/illegalState.kt @@ -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 { diff --git a/compiler/testData/codegen/box/fullJdk/platformTypeAssertionStackTrace.kt b/compiler/testData/codegen/box/fullJdk/platformTypeAssertionStackTrace.kt index 8a704f402db..3c51754ba66 100644 --- a/compiler/testData/codegen/box/fullJdk/platformTypeAssertionStackTrace.kt +++ b/compiler/testData/codegen/box/fullJdk/platformTypeAssertionStackTrace.kt @@ -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)}" diff --git a/compiler/testData/codegen/box/javaInterop/notNullAssertions/destructuringAssignmentWithNullabilityAssertionOnExtensionReceiver_lv12.kt b/compiler/testData/codegen/box/javaInterop/notNullAssertions/destructuringAssignmentWithNullabilityAssertionOnExtensionReceiver_lv12.kt index d52c674dedb..cfc1b02ff08 100644 --- a/compiler/testData/codegen/box/javaInterop/notNullAssertions/destructuringAssignmentWithNullabilityAssertionOnExtensionReceiver_lv12.kt +++ b/compiler/testData/codegen/box/javaInterop/notNullAssertions/destructuringAssignmentWithNullabilityAssertionOnExtensionReceiver_lv12.kt @@ -15,7 +15,7 @@ private operator fun J.component2() = 2 fun use(x: Any) {} fun box(): String { - assertFailsWith { + assertFailsWith { val (a, b) = J.j() } if (!component1Evaluated) return "component1 should be evaluated" diff --git a/compiler/testData/codegen/box/javaInterop/notNullAssertions/errorMessage.kt b/compiler/testData/codegen/box/javaInterop/notNullAssertions/errorMessage.kt index db6aab7ffb2..f75c88a32e9 100644 --- a/compiler/testData/codegen/box/javaInterop/notNullAssertions/errorMessage.kt +++ b/compiler/testData/codegen/box/javaInterop/notNullAssertions/errorMessage.kt @@ -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 diff --git a/compiler/testData/codegen/box/javaInterop/notNullAssertions/extensionReceiverParameter.kt b/compiler/testData/codegen/box/javaInterop/notNullAssertions/extensionReceiverParameter.kt index d344ab01a05..5edce7a2c16 100644 --- a/compiler/testData/codegen/box/javaInterop/notNullAssertions/extensionReceiverParameter.kt +++ b/compiler/testData/codegen/box/javaInterop/notNullAssertions/extensionReceiverParameter.kt @@ -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"; } } diff --git a/compiler/testData/codegen/box/javaInterop/notNullAssertions/functionWithBigArity.kt b/compiler/testData/codegen/box/javaInterop/notNullAssertions/functionWithBigArity.kt index 6afac16807a..a5f2c6f1583 100644 --- a/compiler/testData/codegen/box/javaInterop/notNullAssertions/functionWithBigArity.kt +++ b/compiler/testData/codegen/box/javaInterop/notNullAssertions/functionWithBigArity.kt @@ -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); } } } diff --git a/compiler/testData/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiver.kt b/compiler/testData/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiver.kt index 25e286b3179..ec1a5bbeed1 100644 --- a/compiler/testData/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiver.kt +++ b/compiler/testData/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiver.kt @@ -8,7 +8,7 @@ import kotlin.test.* operator fun A.inc() = A() fun box(): String { - assertFailsWith { + assertFailsWith { var aNull = A.n() aNull++ } diff --git a/compiler/testData/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator.kt b/compiler/testData/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator.kt index 051882917da..3c341674567 100644 --- a/compiler/testData/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator.kt +++ b/compiler/testData/codegen/box/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiverInPrivateOperator.kt @@ -8,7 +8,7 @@ import kotlin.test.* private operator fun A.inc() = A() fun box(): String { - assertFailsWith { + assertFailsWith { var aNull = A.n() aNull++ } diff --git a/compiler/testData/codegen/box/javaInterop/notNullAssertions/localEntities.kt b/compiler/testData/codegen/box/javaInterop/notNullAssertions/localEntities.kt index 02f01f8196d..0788277d7b0 100644 --- a/compiler/testData/codegen/box/javaInterop/notNullAssertions/localEntities.kt +++ b/compiler/testData/codegen/box/javaInterop/notNullAssertions/localEntities.kt @@ -16,7 +16,7 @@ public class F { inline fun expectAssertion(f: () -> (T) -> U): Unit? { try { F.passNull(f()) - } catch (e: IllegalArgumentException) { + } catch (e: NullPointerException) { return Unit } return null diff --git a/compiler/testData/codegen/box/javaInterop/notNullAssertions/nonNullableTypeParameter.kt b/compiler/testData/codegen/box/javaInterop/notNullAssertions/nonNullableTypeParameter.kt index 5d371eb1a55..147e938867b 100644 --- a/compiler/testData/codegen/box/javaInterop/notNullAssertions/nonNullableTypeParameter.kt +++ b/compiler/testData/codegen/box/javaInterop/notNullAssertions/nonNullableTypeParameter.kt @@ -10,7 +10,7 @@ class C : I fun box() = try { B.f() "FAIL" -} catch (e: IllegalArgumentException) { +} catch (e: NullPointerException) { "OK" } diff --git a/compiler/testData/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnExtensionReceiver.kt b/compiler/testData/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnExtensionReceiver.kt index f5c128020a3..2d73b561374 100644 --- a/compiler/testData/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnExtensionReceiver.kt +++ b/compiler/testData/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnExtensionReceiver.kt @@ -8,7 +8,7 @@ import kotlin.test.* fun String.extension() {} fun box(): String { - assertFailsWith { J.s().extension() } + assertFailsWith { J.s().extension() } return "OK" } diff --git a/compiler/testData/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnInlineFunExtensionReceiver.kt b/compiler/testData/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnInlineFunExtensionReceiver.kt index b94d69b2539..dcdeeb29810 100644 --- a/compiler/testData/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnInlineFunExtensionReceiver.kt +++ b/compiler/testData/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnInlineFunExtensionReceiver.kt @@ -8,7 +8,7 @@ import kotlin.test.* inline fun String.extension() {} fun box(): String { - assertFailsWith { + assertFailsWith { J.s().extension() } return "OK" diff --git a/compiler/testData/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnMemberExtensionReceiver.kt b/compiler/testData/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnMemberExtensionReceiver.kt index 7eeec796654..d62a0670301 100644 --- a/compiler/testData/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnMemberExtensionReceiver.kt +++ b/compiler/testData/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnMemberExtensionReceiver.kt @@ -11,7 +11,7 @@ class C { } fun box(): String { - assertFailsWith { C().test() } + assertFailsWith { C().test() } return "OK" } diff --git a/compiler/testData/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnPrivateMemberExtensionReceiver.kt b/compiler/testData/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnPrivateMemberExtensionReceiver.kt index 4ec9aa48b8e..194a9c5b8c6 100644 --- a/compiler/testData/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnPrivateMemberExtensionReceiver.kt +++ b/compiler/testData/codegen/box/javaInterop/notNullAssertions/nullabilityAssertionOnPrivateMemberExtensionReceiver.kt @@ -11,7 +11,7 @@ class C { } fun box(): String { - assertFailsWith { + assertFailsWith { C().test() } return "OK" diff --git a/compiler/testData/codegen/box/javaInterop/notNullAssertions/paramAssertionMessage.kt b/compiler/testData/codegen/box/javaInterop/notNullAssertions/paramAssertionMessage.kt index ac7fdbeb8d7..8dfe3d599cf 100644 --- a/compiler/testData/codegen/box/javaInterop/notNullAssertions/paramAssertionMessage.kt +++ b/compiler/testData/codegen/box/javaInterop/notNullAssertions/paramAssertionMessage.kt @@ -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" diff --git a/compiler/testData/codegen/box/javaInterop/notNullAssertions/staticCallErrorMessage.kt b/compiler/testData/codegen/box/javaInterop/notNullAssertions/staticCallErrorMessage.kt index dd7e45d6d3f..e45b126c20d 100644 --- a/compiler/testData/codegen/box/javaInterop/notNullAssertions/staticCallErrorMessage.kt +++ b/compiler/testData/codegen/box/javaInterop/notNullAssertions/staticCallErrorMessage.kt @@ -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 diff --git a/compiler/testData/codegen/box/oldLanguageVersions/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiver_lv11.kt b/compiler/testData/codegen/box/oldLanguageVersions/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiver_lv11.kt index 3fad1ccbeac..ecbfa827ac1 100644 --- a/compiler/testData/codegen/box/oldLanguageVersions/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiver_lv11.kt +++ b/compiler/testData/codegen/box/oldLanguageVersions/javaInterop/notNullAssertions/incWithNullabilityAssertionOnExtensionReceiver_lv11.kt @@ -9,7 +9,7 @@ import kotlin.test.* operator fun A.inc() = A() fun box(): String { - assertFailsWith { + assertFailsWith { var aNull = A.n() aNull++ } diff --git a/compiler/testData/codegen/box/oldLanguageVersions/javaInterop/notNullAssertions/nullabilityAssertionOnExtensionReceiver_lv11.kt b/compiler/testData/codegen/box/oldLanguageVersions/javaInterop/notNullAssertions/nullabilityAssertionOnExtensionReceiver_lv11.kt index 4b33fdd3ce0..c7359c86c38 100644 --- a/compiler/testData/codegen/box/oldLanguageVersions/javaInterop/notNullAssertions/nullabilityAssertionOnExtensionReceiver_lv11.kt +++ b/compiler/testData/codegen/box/oldLanguageVersions/javaInterop/notNullAssertions/nullabilityAssertionOnExtensionReceiver_lv11.kt @@ -8,7 +8,7 @@ import kotlin.test.* fun String.extension() {} fun box(): String { - assertFailsWith { J.s().extension() } + assertFailsWith { J.s().extension() } return "OK" } diff --git a/compiler/testData/codegen/box/regressions/typeCastException.kt b/compiler/testData/codegen/box/regressions/typeCastException.kt index 4ab35fa6585..f66878d6912 100644 --- a/compiler/testData/codegen/box/regressions/typeCastException.kt +++ b/compiler/testData/codegen/box/regressions/typeCastException.kt @@ -12,7 +12,7 @@ fun box(): String { val a: Any? = null a as Array } - catch (e: TypeCastException) { + catch (e: NullPointerException) { if (e.message != "null cannot be cast to non-null type kotlin.Array") { 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" } diff --git a/compiler/testData/codegen/boxAgainstJava/ieee754/explicitCompareCall.kt b/compiler/testData/codegen/boxAgainstJava/ieee754/explicitCompareCall.kt index 049ca1717c3..9ddfb37f95e 100644 --- a/compiler/testData/codegen/boxAgainstJava/ieee754/explicitCompareCall.kt +++ b/compiler/testData/codegen/boxAgainstJava/ieee754/explicitCompareCall.kt @@ -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) { } diff --git a/compiler/testData/codegen/boxAgainstJava/inline/kt19910.kt b/compiler/testData/codegen/boxAgainstJava/inline/kt19910.kt index 44f766f071b..2c8dc93bd1e 100644 --- a/compiler/testData/codegen/boxAgainstJava/inline/kt19910.kt +++ b/compiler/testData/codegen/boxAgainstJava/inline/kt19910.kt @@ -31,7 +31,7 @@ fun box(): String { } }) }.run() - } catch (e: IllegalArgumentException) { + } catch (e: NullPointerException) { return "OK" } diff --git a/compiler/testData/codegen/boxAgainstJava/notNullAssertions/callAssertions.kt b/compiler/testData/codegen/boxAgainstJava/notNullAssertions/callAssertions.kt index 99ff8c1da28..898a76108b4 100644 --- a/compiler/testData/codegen/boxAgainstJava/notNullAssertions/callAssertions.kt +++ b/compiler/testData/codegen/boxAgainstJava/notNullAssertions/callAssertions.kt @@ -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") } } diff --git a/compiler/testData/codegen/boxAgainstJava/notNullAssertions/delegation.kt b/compiler/testData/codegen/boxAgainstJava/notNullAssertions/delegation.kt index 2274ebd2326..dee894f067d 100644 --- a/compiler/testData/codegen/boxAgainstJava/notNullAssertions/delegation.kt +++ b/compiler/testData/codegen/boxAgainstJava/notNullAssertions/delegation.kt @@ -15,7 +15,7 @@ fun box(): String { DelegateFrom().foo() return "Fail: should have been an exception" } - catch(e: IllegalStateException) { + catch(e: NullPointerException) { return "OK" } } diff --git a/compiler/testData/codegen/boxAgainstJava/notNullAssertions/doGenerateParamAssertions.kt b/compiler/testData/codegen/boxAgainstJava/notNullAssertions/doGenerateParamAssertions.kt index 5596a6c4077..170e31be093 100644 --- a/compiler/testData/codegen/boxAgainstJava/notNullAssertions/doGenerateParamAssertions.kt +++ b/compiler/testData/codegen/boxAgainstJava/notNullAssertions/doGenerateParamAssertions.kt @@ -11,10 +11,10 @@ public abstract class C { 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"); } } diff --git a/compiler/testData/codegen/boxAgainstJava/notNullAssertions/rightElvisOperand.kt b/compiler/testData/codegen/boxAgainstJava/notNullAssertions/rightElvisOperand.kt index 6e49194ed76..f05fe1beb0e 100644 --- a/compiler/testData/codegen/boxAgainstJava/notNullAssertions/rightElvisOperand.kt +++ b/compiler/testData/codegen/boxAgainstJava/notNullAssertions/rightElvisOperand.kt @@ -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" } } diff --git a/compiler/testData/codegen/boxAgainstJava/platformTypes/kt14989.kt b/compiler/testData/codegen/boxAgainstJava/platformTypes/kt14989.kt index 1f7ca2e9ac4..e41114c8b5e 100644 --- a/compiler/testData/codegen/boxAgainstJava/platformTypes/kt14989.kt +++ b/compiler/testData/codegen/boxAgainstJava/platformTypes/kt14989.kt @@ -19,7 +19,7 @@ fun box(): String { try { test(JavaClass().test()) } - catch (e: IllegalStateException) { + catch (e: NullPointerException) { return "OK" } return "fail" diff --git a/compiler/testData/codegen/bytecodeText/inlineClasses/assertionsForParametersOfInlineClassTypes.kt b/compiler/testData/codegen/bytecodeText/inlineClasses/assertionsForParametersOfInlineClassTypes.kt index f47bcef05d0..3e57e407647 100644 --- a/compiler/testData/codegen/bytecodeText/inlineClasses/assertionsForParametersOfInlineClassTypes.kt +++ b/compiler/testData/codegen/bytecodeText/inlineClasses/assertionsForParametersOfInlineClassTypes.kt @@ -14,8 +14,8 @@ fun asNullablePrimitive(c: AsNonNullPrimitive?) {} fun asNullableReference(c: AsNonNullReference?) {} // JVM_TEMPLATES -// 6 checkParameterIsNotNull -// 0 checkNotNullParameter +// 0 checkParameterIsNotNull +// 6 checkNotNullParameter // JVM_IR_TEMPLATES // 4 checkParameterIsNotNull diff --git a/compiler/testData/codegen/bytecodeText/notNullAssertions/arrayListGet.kt b/compiler/testData/codegen/bytecodeText/notNullAssertions/arrayListGet.kt index c9f44cf2a0a..6c89da9e8a8 100644 --- a/compiler/testData/codegen/bytecodeText/notNullAssertions/arrayListGet.kt +++ b/compiler/testData/codegen/bytecodeText/notNullAssertions/arrayListGet.kt @@ -8,7 +8,7 @@ fun foo(): Any { fun bar(a: ArrayList) { } -// 1 checkExpressionValueIsNotNull -// 0 checkNotNullExpressionValue -// 1 checkParameterIsNotNull -// 0 checkNotNullParameter +// 0 checkExpressionValueIsNotNull +// 1 checkNotNullExpressionValue +// 0 checkParameterIsNotNull +// 1 checkNotNullParameter diff --git a/compiler/testData/codegen/bytecodeText/notNullAssertions/assertionForNotNullCaptured.kt b/compiler/testData/codegen/bytecodeText/notNullAssertions/assertionForNotNullCaptured.kt index a6071d619ae..3633b5db67b 100644 --- a/compiler/testData/codegen/bytecodeText/notNullAssertions/assertionForNotNullCaptured.kt +++ b/compiler/testData/codegen/bytecodeText/notNullAssertions/assertionForNotNullCaptured.kt @@ -6,5 +6,5 @@ public fun foo(x: MutableCollection, block: java.util.AbstractLi x.add(block.get(0)) } -// 1 checkExpressionValueIsNotNull -// 0 checkNotNullExpressionValue +// 0 checkExpressionValueIsNotNull +// 1 checkNotNullExpressionValue diff --git a/compiler/testData/codegen/bytecodeText/notNullAssertions/assertionForNotNullTypeParam.kt b/compiler/testData/codegen/bytecodeText/notNullAssertions/assertionForNotNullTypeParam.kt index a676d953ea6..9d871580c6d 100644 --- a/compiler/testData/codegen/bytecodeText/notNullAssertions/assertionForNotNullTypeParam.kt +++ b/compiler/testData/codegen/bytecodeText/notNullAssertions/assertionForNotNullTypeParam.kt @@ -1,4 +1,4 @@ fun foo(t: T) = t -// 1 checkParameterIsNotNull -// 0 checkNotNullParameter +// 0 checkParameterIsNotNull +// 1 checkNotNullParameter diff --git a/compiler/testData/codegen/bytecodeText/notNullAssertions/javaMultipleSubstitutions.kt b/compiler/testData/codegen/bytecodeText/notNullAssertions/javaMultipleSubstitutions.kt index 0bf91dd47e3..13103cb1e6c 100644 --- a/compiler/testData/codegen/bytecodeText/notNullAssertions/javaMultipleSubstitutions.kt +++ b/compiler/testData/codegen/bytecodeText/notNullAssertions/javaMultipleSubstitutions.kt @@ -32,7 +32,7 @@ internal fun bar(a: A, b: B, c: C) { } // @JavaMultipleSubstitutionsKt.class -// 3 checkExpressionValueIsNotNull -// 0 checkNotNullExpressionValue -// 3 checkParameterIsNotNull -// 0 checkNotNullParameter +// 0 checkExpressionValueIsNotNull +// 3 checkNotNullExpressionValue +// 0 checkParameterIsNotNull +// 3 checkNotNullParameter diff --git a/compiler/testData/codegen/bytecodeText/nullCheckOptimization/expressionValueIsNotNullTwice.kt b/compiler/testData/codegen/bytecodeText/nullCheckOptimization/expressionValueIsNotNullTwice.kt index cae43053ca9..1b74a7fae1e 100644 --- a/compiler/testData/codegen/bytecodeText/nullCheckOptimization/expressionValueIsNotNullTwice.kt +++ b/compiler/testData/codegen/bytecodeText/nullCheckOptimization/expressionValueIsNotNullTwice.kt @@ -21,5 +21,5 @@ fun test() { // @KKt.class: // 1 LDC "a" -// 1 checkExpressionValueIsNotNull -// 0 checkNotNullExpressionValue +// 0 checkExpressionValueIsNotNull +// 1 checkNotNullExpressionValue