Enable ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated since 1.7

^KT-36770 Fixed
This commit is contained in:
Denis.Zharkov
2021-08-11 17:43:49 +03:00
committed by teamcityserver
parent d91155558b
commit 4a9d4ed9fe
60 changed files with 139 additions and 140 deletions
@@ -43,8 +43,7 @@ fun main(ak: AK, akn: AKN, bk: BK, ck: CK, ckn: CKN): Unit {
// jspecify_nullness_mismatch
ak.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
// jspecify_nullness_mismatch
akn.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>) // the corresponding warning/error is present on the Java side
akn.foo(null) // the corresponding warning/error is present on the Java side
bk.foo(bk)
// jspecify_nullness_mismatch
@@ -54,6 +53,5 @@ fun main(ak: AK, akn: AKN, bk: BK, ck: CK, ckn: CKN): Unit {
// jspecify_nullness_mismatch
ck.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
// jspecify_nullness_mismatch
ckn.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>) // the corresponding warning/error is present on the Java side
}
ckn.foo(null) // the corresponding warning/error is present on the Java side
}
@@ -22,24 +22,20 @@ public class Test {}
// FILE: main.kt
fun <T : Test> main(a1: A<Any?>, a2: A<Test>, b1: B<Any?>, b2: B<Test>, x: T): Unit {
a1.foo(null)
// jspecify_nullness_mismatch
a1.bar<T?>(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
a1.bar<T?>(null)
a1.bar<T>(x)
a2.foo(null)
// jspecify_nullness_mismatch
a2.bar<T?>(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
a2.bar<T?>(null)
a2.bar<T>(x)
// jspecify_nullness_mismatch
b1.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
// jspecify_nullness_mismatch
b1.bar<T?>(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
b1.bar<T?>(null)
b1.bar<T>(x)
// jspecify_nullness_mismatch
b2.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
// jspecify_nullness_mismatch
b2.bar<T?>(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
b2.bar<T?>(null)
b2.bar<T>(x)
}
}