From 0e4e5ac287c3836ca4434c2c6f626b9145c284e5 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Fri, 27 Dec 2019 18:14:20 +0300 Subject: [PATCH] Update nullability assertion tests that use newer Java features --- .../box/ranges/javaInterop/javaCollectionOfExplicitNotNull.kt | 1 + .../javaInterop/javaCollectionOfExplicitNotNullFailFast.kt | 1 + .../box/ranges/javaInterop/javaCollectionOfExplicitNullable.kt | 1 + .../box/ranges/javaInterop/javaCollectionOfInheritedNotNull.kt | 2 +- .../box/ranges/javaInterop/javaCollectionOfMaybeNullable.kt | 2 +- .../javaCollectionOfMaybeNullableWithNotNullLoopVariable.kt | 2 +- .../ranges/javaInterop/javaCollectionOfNotNullToTypedArray.kt | 1 + .../javaInterop/javaCollectionOfNotNullToTypedArrayFailFast.kt | 1 + .../codegen/box/ranges/javaInterop/javaIteratorOfNotNull.kt | 1 + .../box/ranges/javaInterop/javaIteratorOfNotNullFailFast.kt | 1 + .../withIndex/javaCollectionOfExplicitNotNullWithIndex.kt | 1 + .../javaCollectionOfExplicitNotNullWithIndexFailFast.kt | 1 + .../withIndex/javaCollectionOfExplicitNullableWithIndex.kt | 1 + .../withIndex/javaCollectionOfMaybeNullableWithIndex.kt | 2 +- ...CollectionOfMaybeNullableWithIndexWithNotNullLoopVariable.kt | 2 +- .../javaInterop/withIndex/javaIteratorOfNotNullWithIndex.kt | 1 + .../withIndex/javaIteratorOfNotNullWithIndexFailFast.kt | 1 + 17 files changed, 17 insertions(+), 5 deletions(-) diff --git a/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNotNull.kt b/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNotNull.kt index 4a84576c64a..c5f9a53ab3f 100644 --- a/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNotNull.kt +++ b/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNotNull.kt @@ -2,6 +2,7 @@ // TARGET_BACKEND: JVM // IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME +// JVM_TARGET: 1.8 // FILE: box.kt import kotlin.test.* diff --git a/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNotNullFailFast.kt b/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNotNullFailFast.kt index 19614f5a24c..e61cdec4f2a 100644 --- a/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNotNullFailFast.kt +++ b/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNotNullFailFast.kt @@ -3,6 +3,7 @@ // IGNORE_BACKEND: JVM // IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME +// JVM_TARGET: 1.8 // Note: This fails on JVM (non-IR) with "Fail: should throw on get() in loop header". The not-null assertion is not generated when // assigning to the loop variable. The root cause seems to be that the loop variable is a KtParameter and diff --git a/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNullable.kt b/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNullable.kt index 20436ad39ba..c302b6b402b 100644 --- a/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNullable.kt +++ b/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfExplicitNullable.kt @@ -2,6 +2,7 @@ // TARGET_BACKEND: JVM // IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME +// JVM_TARGET: 1.8 // FILE: box.kt import kotlin.test.* diff --git a/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfInheritedNotNull.kt b/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfInheritedNotNull.kt index 1e47f47a98f..11c24cc495f 100644 --- a/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfInheritedNotNull.kt +++ b/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfInheritedNotNull.kt @@ -26,7 +26,7 @@ public class JImpl implements J { // Type argument (Int) gets @EnhancedNullability because it is not nullable in overridden Kotlin function. @Override public List listOfNotNull() { - List list = new ArrayList<>(); + List list = new ArrayList(); list.add(42); list.add(-42); return list; diff --git a/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfMaybeNullable.kt b/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfMaybeNullable.kt index 38509405997..2b9da1e27d9 100644 --- a/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfMaybeNullable.kt +++ b/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfMaybeNullable.kt @@ -20,7 +20,7 @@ import java.util.*; public class J { public static List listOfMaybeNullable() { - List list = new ArrayList<>(); + List list = new ArrayList(); list.add(42); list.add(null); return list; diff --git a/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfMaybeNullableWithNotNullLoopVariable.kt b/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfMaybeNullableWithNotNullLoopVariable.kt index efb9e015049..f900d19d40c 100644 --- a/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfMaybeNullableWithNotNullLoopVariable.kt +++ b/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfMaybeNullableWithNotNullLoopVariable.kt @@ -20,7 +20,7 @@ import java.util.*; public class J { public static List listOfMaybeNullable() { - List list = new ArrayList<>(); + List list = new ArrayList(); list.add(42); list.add(-42); return list; diff --git a/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullToTypedArray.kt b/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullToTypedArray.kt index dc05053a6c6..a1da80b2564 100644 --- a/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullToTypedArray.kt +++ b/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullToTypedArray.kt @@ -2,6 +2,7 @@ // TARGET_BACKEND: JVM // IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME +// JVM_TARGET: 1.8 // FILE: box.kt import kotlin.test.* diff --git a/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullToTypedArrayFailFast.kt b/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullToTypedArrayFailFast.kt index 4ab724ccb20..014f3aca7d3 100644 --- a/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullToTypedArrayFailFast.kt +++ b/compiler/testData/codegen/box/ranges/javaInterop/javaCollectionOfNotNullToTypedArrayFailFast.kt @@ -3,6 +3,7 @@ // IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JVM // WITH_RUNTIME +// JVM_TARGET: 1.8 // Note: This fails on JVM (non-IR) with "Fail: should throw on get() in loop header". The not-null assertion is not generated when // assigning to the loop variable. The root cause seems to be that the loop variable is a KtParameter and diff --git a/compiler/testData/codegen/box/ranges/javaInterop/javaIteratorOfNotNull.kt b/compiler/testData/codegen/box/ranges/javaInterop/javaIteratorOfNotNull.kt index a50e023af01..dc935275d1a 100644 --- a/compiler/testData/codegen/box/ranges/javaInterop/javaIteratorOfNotNull.kt +++ b/compiler/testData/codegen/box/ranges/javaInterop/javaIteratorOfNotNull.kt @@ -2,6 +2,7 @@ // TARGET_BACKEND: JVM // IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME +// JVM_TARGET: 1.8 // FILE: box.kt import kotlin.test.* diff --git a/compiler/testData/codegen/box/ranges/javaInterop/javaIteratorOfNotNullFailFast.kt b/compiler/testData/codegen/box/ranges/javaInterop/javaIteratorOfNotNullFailFast.kt index 08bf80668e4..381298936c7 100644 --- a/compiler/testData/codegen/box/ranges/javaInterop/javaIteratorOfNotNullFailFast.kt +++ b/compiler/testData/codegen/box/ranges/javaInterop/javaIteratorOfNotNullFailFast.kt @@ -3,6 +3,7 @@ // IGNORE_BACKEND: JVM // IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME +// JVM_TARGET: 1.8 // Note: This fails on JVM (non-IR) with "Fail: should throw on get() in loop header". The not-null assertion is not generated when // assigning to the loop variable. The root cause seems to be that the loop variable is a KtParameter and diff --git a/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfExplicitNotNullWithIndex.kt b/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfExplicitNotNullWithIndex.kt index d55d2375c15..a89d0557864 100644 --- a/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfExplicitNotNullWithIndex.kt +++ b/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfExplicitNotNullWithIndex.kt @@ -2,6 +2,7 @@ // TARGET_BACKEND: JVM // IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME +// JVM_TARGET: 1.8 // FILE: box.kt import kotlin.test.* diff --git a/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfExplicitNotNullWithIndexFailFast.kt b/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfExplicitNotNullWithIndexFailFast.kt index 97678400f4b..0f16bd03b40 100644 --- a/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfExplicitNotNullWithIndexFailFast.kt +++ b/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfExplicitNotNullWithIndexFailFast.kt @@ -3,6 +3,7 @@ // IGNORE_BACKEND: JVM // IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME +// JVM_TARGET: 1.8 // Note: This fails on JVM (non-IR) with "Fail: should throw on get()". The not-null assertion is not generated when assigning to the // variables in the destructuring declaration. The root cause seems to be that diff --git a/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfExplicitNullableWithIndex.kt b/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfExplicitNullableWithIndex.kt index e88b8c44dab..185a5d92944 100644 --- a/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfExplicitNullableWithIndex.kt +++ b/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfExplicitNullableWithIndex.kt @@ -2,6 +2,7 @@ // TARGET_BACKEND: JVM // IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME +// JVM_TARGET: 1.8 // FILE: box.kt import kotlin.test.* diff --git a/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfMaybeNullableWithIndex.kt b/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfMaybeNullableWithIndex.kt index 25df14cf2e3..5e674becc74 100644 --- a/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfMaybeNullableWithIndex.kt +++ b/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfMaybeNullableWithIndex.kt @@ -23,7 +23,7 @@ import java.util.*; public class J { public static List listOfMaybeNullable() { - List list = new ArrayList<>(); + List list = new ArrayList(); list.add(42); list.add(null); return list; diff --git a/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariable.kt b/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariable.kt index 68d4ba97c66..ae3d5c18b2b 100644 --- a/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariable.kt +++ b/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaCollectionOfMaybeNullableWithIndexWithNotNullLoopVariable.kt @@ -23,7 +23,7 @@ import java.util.*; public class J { public static List listOfMaybeNullable() { - List list = new ArrayList<>(); + List list = new ArrayList(); list.add(42); list.add(-42); return list; diff --git a/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaIteratorOfNotNullWithIndex.kt b/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaIteratorOfNotNullWithIndex.kt index 79174fea072..5b36a78c471 100644 --- a/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaIteratorOfNotNullWithIndex.kt +++ b/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaIteratorOfNotNullWithIndex.kt @@ -2,6 +2,7 @@ // TARGET_BACKEND: JVM // IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME +// JVM_TARGET: 1.8 // FILE: box.kt import kotlin.test.* diff --git a/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaIteratorOfNotNullWithIndexFailFast.kt b/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaIteratorOfNotNullWithIndexFailFast.kt index b70982ab3a8..456db42ae5b 100644 --- a/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaIteratorOfNotNullWithIndexFailFast.kt +++ b/compiler/testData/codegen/box/ranges/javaInterop/withIndex/javaIteratorOfNotNullWithIndexFailFast.kt @@ -3,6 +3,7 @@ // IGNORE_BACKEND: JVM // IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME +// JVM_TARGET: 1.8 // Note: This fails on JVM (non-IR) with "Fail: should throw on get()". The not-null assertion is not generated when assigning to the // variables in the destructuring declaration. The root cause seems to be that