40c4e865c7
This commit in fact changes two very related places: - first, it implements forgotten 'enhancedForWarnings' in K2 enhancement - second, it repeats KT-48515 fix for K2 while enhancing wildcards #KT-65594 Fixed Related to KT-48515, KT-63746
37 lines
1.4 KiB
Kotlin
Vendored
37 lines
1.4 KiB
Kotlin
Vendored
// FIR_IDENTICAL
|
|
// FILE: NullnessUnspecifiedTypeParameter.java
|
|
import org.jspecify.annotations.*;
|
|
|
|
@NullMarked
|
|
public class NullnessUnspecifiedTypeParameter<T> {
|
|
public void foo(T t) {}
|
|
|
|
public void bar(Test s, T t) {} // t should not become not nullable
|
|
}
|
|
|
|
// FILE: Test.java
|
|
public class Test {}
|
|
|
|
// FILE: main.kt
|
|
// jspecify_nullness_mismatch
|
|
fun main(a1: NullnessUnspecifiedTypeParameter<Any>, a2: NullnessUnspecifiedTypeParameter<<!UPPER_BOUND_VIOLATED_BASED_ON_JAVA_ANNOTATIONS!>Any?<!>>, x: Test): Unit {
|
|
// jspecify_nullness_mismatch
|
|
a1.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
|
a1.foo(1)
|
|
|
|
// jspecify_nullness_mismatch
|
|
a2.foo(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
|
a2.foo(1)
|
|
|
|
// jspecify_nullness_mismatch, jspecify_nullness_mismatch
|
|
a1.bar(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>, <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
|
// jspecify_nullness_mismatch
|
|
a1.bar(x, <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
|
a1.bar(x, 1)
|
|
|
|
// jspecify_nullness_mismatch, jspecify_nullness_mismatch
|
|
a2.bar(<!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>, <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
|
// jspecify_nullness_mismatch
|
|
a2.bar(x, <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!>)
|
|
a2.bar(x, 1)
|
|
} |