9dd8eda1c9
Library methods such as 'listOf' are resolved to have the package fragments as their parents, but JVM expects their containing file classes as parents. This fix generates those file classes and uses them as parent replacements for such library methods.
28 lines
570 B
Kotlin
Vendored
28 lines
570 B
Kotlin
Vendored
// !LANGUAGE: +StrictJavaNullabilityAssertions
|
|
// TARGET_BACKEND: JVM
|
|
// WITH_RUNTIME
|
|
|
|
// FILE: box.kt
|
|
import kotlin.test.*
|
|
|
|
fun box(): String {
|
|
val actualValues = mutableListOf<Int>()
|
|
for (i in J.listOfMaybeNullable()) {
|
|
actualValues += i
|
|
}
|
|
assertEquals(listOf(42, null), actualValues)
|
|
return "OK"
|
|
}
|
|
|
|
// FILE: J.java
|
|
import java.util.*;
|
|
|
|
public class J {
|
|
public static List<Integer> listOfMaybeNullable() {
|
|
List<Integer> list = new ArrayList<Integer>();
|
|
list.add(42);
|
|
list.add(null);
|
|
return list;
|
|
}
|
|
}
|