Files
kotlin/compiler/testData/codegen/bytecodeText/notNullAssertions/javaMultipleSubstitutions.kt
Alexander Udalov 480313210a Use Intrinsics.checkNotNullExpressionValue to throw NPE in Java null checks
Similarly to previous commit, this method was unused since its
introduction before 1.0, so we're changing its semantics to throw NPE
and starting to use it with API version >= 1.4.

 #KT-22275 In Progress
2019-08-12 16:09:23 +02:00

40 lines
805 B
Kotlin
Vendored

// IGNORE_BACKEND: JVM_IR
// Missing IMPLICIT_NOTNULL casts
// FILE: A.java
import org.jetbrains.annotations.NotNull;
class A<T, U> {
@NotNull
T foo() { return null; }
}
// FILE: B.java
import org.jetbrains.annotations.NotNull;
class B<T> extends A<T, Integer> {
@Override
@NotNull
T foo() { return null; }
}
// FILE: C.java
import org.jetbrains.annotations.NotNull;
class C extends B<String> {
@Override
@NotNull
String foo() { return null; }
}
// FILE: javaMultipleSubstitutions.kt
internal fun bar(a: A<String, Int>, b: B<String>, c: C) {
val sa: String = a.foo()
val sb: String = b.foo()
val sc: String = c.foo()
}
// @JavaMultipleSubstitutionsKt.class
// 3 checkExpressionValueIsNotNull
// 0 checkNotNullExpressionValue
// 3 checkParameterIsNotNull