Use Intrinsics.checkNotNullParameter to throw NPE in parameter null checks
Similarly to previous commits, this method was unused, so we're changing its semantics in API version >= 1.4. #KT-22275 In Progress
This commit is contained in:
+5
@@ -16429,6 +16429,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/nullCheckOptimization/kt7774.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("parameterNullCheckThrowsNpe_1_4.kt")
|
||||
public void testParameterNullCheckThrowsNpe_1_4() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/nullCheckOptimization/parameterNullCheckThrowsNpe_1_4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("primitiveCheckWithSideEffect.kt")
|
||||
public void testPrimitiveCheckWithSideEffect() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/nullCheckOptimization/primitiveCheckWithSideEffect.kt");
|
||||
|
||||
+18
@@ -2473,6 +2473,24 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/nullChecks")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class NullChecks extends AbstractBlackBoxInlineCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInNullChecks() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/nullChecks"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("parameterNullCheck_1_4.kt")
|
||||
public void testParameterNullCheck_1_4() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/nullChecks/parameterNullCheck_1_4.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/optimizations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -3163,6 +3163,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
||||
runTest("compiler/testData/codegen/bytecodeText/notNullAssertions/assertionForNotNullTypeParam.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("assertionForNotNullTypeParam_1_4.kt")
|
||||
public void testAssertionForNotNullTypeParam_1_4() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/notNullAssertions/assertionForNotNullTypeParam_1_4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("doNotGenerateParamAssertions.kt")
|
||||
public void testDoNotGenerateParamAssertions() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/notNullAssertions/doNotGenerateParamAssertions.kt");
|
||||
@@ -3296,6 +3301,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
||||
runTest("compiler/testData/codegen/bytecodeText/nullCheckOptimization/redundantSafeCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("redundantSafeCall_1_4.kt")
|
||||
public void testRedundantSafeCall_1_4() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/nullCheckOptimization/redundantSafeCall_1_4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("reifiedIs.kt")
|
||||
public void testReifiedIs() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/nullCheckOptimization/reifiedIs.kt");
|
||||
|
||||
Generated
+18
@@ -2473,6 +2473,24 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/nullChecks")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class NullChecks extends AbstractCompileKotlinAgainstInlineKotlinTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInNullChecks() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/nullChecks"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("parameterNullCheck_1_4.kt")
|
||||
public void testParameterNullCheck_1_4() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/nullChecks/parameterNullCheck_1_4.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/optimizations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+5
@@ -16429,6 +16429,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/nullCheckOptimization/kt7774.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("parameterNullCheckThrowsNpe_1_4.kt")
|
||||
public void testParameterNullCheckThrowsNpe_1_4() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/nullCheckOptimization/parameterNullCheckThrowsNpe_1_4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("primitiveCheckWithSideEffect.kt")
|
||||
public void testPrimitiveCheckWithSideEffect() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/nullCheckOptimization/primitiveCheckWithSideEffect.kt");
|
||||
|
||||
+5
@@ -15314,6 +15314,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/nullCheckOptimization/kt7774.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("parameterNullCheckThrowsNpe_1_4.kt")
|
||||
public void testParameterNullCheckThrowsNpe_1_4() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/nullCheckOptimization/parameterNullCheckThrowsNpe_1_4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("primitiveCheckWithSideEffect.kt")
|
||||
public void testPrimitiveCheckWithSideEffect() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/nullCheckOptimization/primitiveCheckWithSideEffect.kt");
|
||||
|
||||
+18
@@ -2473,6 +2473,24 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/nullChecks")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class NullChecks extends AbstractIrBlackBoxInlineCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInNullChecks() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxInline/nullChecks"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("parameterNullCheck_1_4.kt")
|
||||
public void testParameterNullCheck_1_4() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/nullChecks/parameterNullCheck_1_4.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxInline/optimizations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+10
@@ -3133,6 +3133,11 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest {
|
||||
runTest("compiler/testData/codegen/bytecodeText/notNullAssertions/assertionForNotNullTypeParam.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("assertionForNotNullTypeParam_1_4.kt")
|
||||
public void testAssertionForNotNullTypeParam_1_4() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/notNullAssertions/assertionForNotNullTypeParam_1_4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("doNotGenerateParamAssertions.kt")
|
||||
public void testDoNotGenerateParamAssertions() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/notNullAssertions/doNotGenerateParamAssertions.kt");
|
||||
@@ -3266,6 +3271,11 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest {
|
||||
runTest("compiler/testData/codegen/bytecodeText/nullCheckOptimization/redundantSafeCall.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("redundantSafeCall_1_4.kt")
|
||||
public void testRedundantSafeCall_1_4() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/nullCheckOptimization/redundantSafeCall_1_4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("reifiedIs.kt")
|
||||
public void testReifiedIs() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/nullCheckOptimization/reifiedIs.kt");
|
||||
|
||||
Reference in New Issue
Block a user