Update test affected by ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated feature

This commit is contained in:
Mikhael Bogdanov
2021-07-01 10:31:57 +02:00
parent 228100ef09
commit 7cbd6908f9
9 changed files with 62 additions and 4 deletions
@@ -0,0 +1,35 @@
// !LANGUAGE: +StrictJavaNullabilityAssertions +ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_LIGHT_ANALYSIS
// FILE: box.kt
fun box(): String {
try {
J().test()
return "Fail: SHOULD throw exception"
}
catch (e: Throwable) {
return "OK"
}
}
// FILE: test.kt
fun withAssertion(j: J) = generic<String?>(j)
fun <T> generic(j: J) = j.nullT<T>()
// FILE: J.java
import org.jetbrains.annotations.NotNull;
public class J {
@NotNull
public <T> T nullT() {
return null;
}
public void test() {
TestKt.withAssertion(this);
}
}