Files
kotlin-fork/compiler/testData/codegen/box/builtinStubMethods/Iterator.kt
T
2020-05-28 22:18:20 +03:00

16 lines
356 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
class MyIterator<T>(val v: T): Iterator<T> {
override fun next(): T = v
override fun hasNext(): Boolean = true
}
fun box(): String {
try {
(MyIterator<String>("") as java.util.Iterator<String>).remove()
throw AssertionError()
} catch (e: UnsupportedOperationException) {
return "OK"
}
}