Rewrite mutable collection stub method generation
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
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
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"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user