Report warnings or errors for violated type parameter's upper bounds from Java annotated with nullability annotations
^KT-43262 Fixed
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
||||
// FULL_JDK
|
||||
|
||||
// FILE: MapLike.java
|
||||
import java.util.Map;
|
||||
|
||||
public interface MapLike<@org.jetbrains.annotations.NotNull K, V> {
|
||||
void putAll(Map<K, V> map);
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun test(map : MapLike<Int?, Int>) {}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// !LANGUAGE: +ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// FULL_JDK
|
||||
|
||||
// FILE: MapLike.java
|
||||
import java.util.Map;
|
||||
|
||||
public interface MapLike<@org.jetbrains.annotations.NotNull K, V> {
|
||||
void putAll(Map<K, V> map);
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun test0(map : MapLike<<!UPPER_BOUND_VIOLATED_BASED_ON_JAVA_ANNOTATIONS!>Int?<!>, Int>) {}
|
||||
fun <K> test11(map : MapLike<<!UPPER_BOUND_VIOLATED_BASED_ON_JAVA_ANNOTATIONS!>K<!>, K>) {}
|
||||
fun <K> test12(map : MapLike<<!UPPER_BOUND_VIOLATED_BASED_ON_JAVA_ANNOTATIONS!>K?<!>, K>) {}
|
||||
fun <K : Any> test13(map : MapLike<K, K>) {}
|
||||
fun <K : Any> test14(map : MapLike<<!UPPER_BOUND_VIOLATED_BASED_ON_JAVA_ANNOTATIONS!>K?<!>, K>) {}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package
|
||||
|
||||
public fun test0(/*0*/ map: MapLike<kotlin.Int?, kotlin.Int>): kotlin.Unit
|
||||
public fun </*0*/ K> test11(/*0*/ map: MapLike<K, K>): kotlin.Unit
|
||||
public fun </*0*/ K> test12(/*0*/ map: MapLike<K?, K>): kotlin.Unit
|
||||
public fun </*0*/ K : kotlin.Any> test13(/*0*/ map: MapLike<K, K>): kotlin.Unit
|
||||
public fun </*0*/ K : kotlin.Any> test14(/*0*/ map: MapLike<K?, K>): kotlin.Unit
|
||||
public fun test2(/*0*/ map: MapLike<kotlin.Int, kotlin.Int>): kotlin.Unit
|
||||
|
||||
public interface MapLike</*0*/ @org.jetbrains.annotations.NotNull K : kotlin.Any!, /*1*/ V : kotlin.Any!> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public abstract fun putAll(/*0*/ map: kotlin.collections.(Mutable)Map<K!, V!>!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user