mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
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
25 lines
367 B
Kotlin
Vendored
25 lines
367 B
Kotlin
Vendored
// KT-6042 java.lang.UnsupportedOperationException with ArrayList
|
|
|
|
import java.util.ArrayList
|
|
|
|
class A : ArrayList<String>()
|
|
|
|
fun box(): String {
|
|
val a = A()
|
|
val b = A()
|
|
|
|
a.addAll(b)
|
|
a.addAll(0, b)
|
|
a.removeAll(b)
|
|
a.retainAll(b)
|
|
a.clear()
|
|
|
|
a.add("")
|
|
a.set(0, "")
|
|
a.add(0, "")
|
|
a.remove(0)
|
|
a.remove("")
|
|
|
|
return "OK"
|
|
}
|