Generating stub methods for read-only map and entry.

This commit is contained in:
Evgeny Gerashchenko
2013-09-25 00:11:31 +04:00
parent d1cfbbbad5
commit b4bb08c013
6 changed files with 143 additions and 4 deletions
@@ -0,0 +1,15 @@
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()
}
fun box(): String {
try {
(MyMapEntry<String, Int>() as MutableMap.MutableEntry<String, Int>).setValue(1)
throw AssertionError()
} catch (e: UnsupportedOperationException) {
return "OK"
}
}