mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-10 15:53:46 +00:00
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
24 lines
513 B
Kotlin
Vendored
24 lines
513 B
Kotlin
Vendored
// !API_VERSION: LATEST
|
|
// TARGET_BACKEND: JVM
|
|
// IGNORE_BACKEND: JVM_IR
|
|
// FILE: A.java
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
public class A {
|
|
@NotNull
|
|
public static String foo() { return null; }
|
|
}
|
|
|
|
// FILE: test.kt
|
|
|
|
fun box(): String {
|
|
try {
|
|
val s: String = A.foo()
|
|
return "Fail: NPE should have been thrown"
|
|
} catch (e: Throwable) {
|
|
if (e::class != NullPointerException::class) return "Fail: exception class should be NPE: ${e::class}"
|
|
return "OK"
|
|
}
|
|
}
|