Files
kotlin/compiler/testData/codegen/box/builtinStubMethods/Iterator.kt
2018-12-21 16:09:11 +01: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"
}
}