Files
kotlin/compiler/testData/codegen/box/builtinStubMethods/MapEntryWithSetValue.kt
Dmitry Petrov 6cb0e5151c KT-9377 Support is-checks for read-only collections
Intrinsics for is/as/as? with mutable Kotlin collections and related types.
2015-10-02 15:17:00 +03:00

15 lines
441 B
Kotlin
Vendored

class MyMapEntry<K, V>: Map.Entry<K, V> {
override fun hashCode(): Int = 0
override fun equals(other: Any?): Boolean = false
override fun getKey(): K = throw UnsupportedOperationException()
override fun getValue(): V = throw UnsupportedOperationException()
public fun setValue(value: V): V = value
}
fun box(): String {
(MyMapEntry<String, Int>() as java.util.Map.Entry<String, Int>).setValue(1)
return "OK"
}