5b58eb8491
Most of these tests used this directive as a way to opt in to a new language feature, and most of those features are already stable for a long time, so no opt-in is needed. Some other tests used the directive to opt out from a language feature, replace those by the `LANGUAGE` directive. One test used the directive to test behavior that actually depended on the API version; use `API_VERSION` directive there instead.
66 lines
1.6 KiB
Kotlin
Vendored
66 lines
1.6 KiB
Kotlin
Vendored
// JVM_TARGET: 1.8
|
|
// IGNORE_BACKEND: JVM_IR
|
|
// TARGET_BACKEND: JVM
|
|
// FULL_JDK
|
|
// WITH_RUNTIME
|
|
|
|
import java.util.stream.*
|
|
|
|
class B<F> : List<F> {
|
|
override val size: Int
|
|
get() = throw UnsupportedOperationException()
|
|
|
|
override fun contains(element: F): Boolean {
|
|
throw UnsupportedOperationException()
|
|
}
|
|
|
|
override fun containsAll(elements: Collection<F>): Boolean {
|
|
throw UnsupportedOperationException()
|
|
}
|
|
|
|
override fun get(index: Int): F {
|
|
throw UnsupportedOperationException()
|
|
}
|
|
|
|
override fun indexOf(element: F): Int {
|
|
throw UnsupportedOperationException()
|
|
}
|
|
|
|
override fun isEmpty(): Boolean {
|
|
throw UnsupportedOperationException()
|
|
}
|
|
|
|
override fun iterator(): Iterator<F> {
|
|
throw UnsupportedOperationException()
|
|
}
|
|
|
|
override fun lastIndexOf(element: F): Int {
|
|
throw UnsupportedOperationException()
|
|
}
|
|
|
|
override fun listIterator(): ListIterator<F> {
|
|
throw UnsupportedOperationException()
|
|
}
|
|
|
|
override fun listIterator(index: Int): ListIterator<F> {
|
|
throw UnsupportedOperationException()
|
|
}
|
|
|
|
override fun subList(fromIndex: Int, toIndex: Int): List<F> {
|
|
throw UnsupportedOperationException()
|
|
}
|
|
|
|
override fun stream() = Stream.of("abc", "ab") as Stream<F>
|
|
}
|
|
|
|
fun box(): String {
|
|
val a: List<String> = listOf("abc", "a", "ab")
|
|
val b = a.stream().filter { it.length > 1 }.collect(Collectors.toList())
|
|
if (b != listOf("abc", "ab")) return "fail 1"
|
|
|
|
val c = B<String>().stream().collect(Collectors.toList())
|
|
if (c != listOf("abc", "ab")) return "fail 2"
|
|
|
|
return "OK"
|
|
}
|