Files
kotlin-fork/compiler/testData/diagnostics/testsWithJava8/targetedBuiltIns/mutableMapRemove.kt
T
Denis Zharkov d259b91143 Add MutableMap.remove(K, V) as built-in declaration
Use PlatformDependent annotation to guarantee it's only be available for JDK8
Also adjust type-safe bridges and mutable collection stubs generation
2016-04-29 15:08:54 +03:00

30 lines
963 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_PARAMETER -PARAMETER_NAME_CHANGED_ON_OVERRIDE
class KotlinMap1<K, V> : java.util.AbstractMap<K, V>() {
override val entries: MutableSet<MutableMap.MutableEntry<K, V>>
get() = throw UnsupportedOperationException()
override fun remove(x: K, y: V) = true
}
class KotlinMap2 : java.util.AbstractMap<String, Int>() {
override val entries: MutableSet<MutableMap.MutableEntry<String, Int>>
get() = throw UnsupportedOperationException()
override fun remove(x: String, y: Int) = true
}
fun foo(x: MutableMap<String, Int>, y: java.util.HashMap<String, Int>, z: java.util.AbstractMap<String, Int>) {
x.remove("", 1)
x.remove("", <!TYPE_MISMATCH!>""<!>)
x.remove("", <!NULL_FOR_NONNULL_TYPE!>null<!>)
y.remove("", 1)
y.remove("", <!TYPE_MISMATCH!>""<!>)
y.remove("", <!NULL_FOR_NONNULL_TYPE!>null<!>)
z.remove("", 1)
z.remove("", <!TYPE_MISMATCH!>""<!>)
z.remove("", null)
}