35e956609a
The main problem of the previous approach was that we were only generating erased method signatures, which was incorrect in case a class also had a member from another supertype with the same signature as the substituted one from the collection. Javac issues compilation errors when compiling Java code against such classes. Also all the needed method stub signatures were hardcoded in generateBuiltInMethodStubs() and the case of MutableListIterator was missing
14 lines
310 B
Kotlin
14 lines
310 B
Kotlin
class MyIterator<E : Number> : Iterator<E> {
|
|
override fun next() = null!!
|
|
override fun hasNext() = null!!
|
|
}
|
|
|
|
fun box(): String {
|
|
try {
|
|
(MyIterator<Int>() as MutableIterator<Number>).remove()
|
|
return "Fail"
|
|
} catch (e: UnsupportedOperationException) {
|
|
return "OK"
|
|
}
|
|
}
|