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:
Victor Petukhov
2021-02-01 16:52:23 +03:00
parent cf4e61bebb
commit befe8599c4
14 changed files with 202 additions and 64 deletions
@@ -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>) {}