Add Map.getOrDefault method as PlatformDependent declaration with refined signature

- First parameter should have type of K instead of Any
- Special bridge should return second parameter if a key has wrong type
- Special bridge may throw an exception if defaultValue has wrong type

 #KT-13209 Fixed
This commit is contained in:
Denis Zharkov
2016-07-27 12:14:08 +03:00
parent 169acf2f31
commit 915e36cb02
15 changed files with 353 additions and 26 deletions
@@ -123,7 +123,7 @@ public interface Map</*0*/ K, /*1*/ out V> {
public abstract fun containsValue(/*0*/ value: @kotlin.UnsafeVariance() V): kotlin.Boolean
public open fun forEach(/*0*/ p0: java.util.function.BiConsumer<in K!, in V!>!): kotlin.Unit
public abstract operator fun get(/*0*/ key: K): V?
public open fun getOrDefault(/*0*/ p0: kotlin.Any!, /*1*/ p1: @kotlin.UnsafeVariance() V!): V!
@kotlin.internal.PlatformDependent() public open fun getOrDefault(/*0*/ key: K, /*1*/ defaultValue: @kotlin.UnsafeVariance() V): V
public abstract fun isEmpty(): kotlin.Boolean
public interface Entry</*0*/ out K, /*1*/ out V> {
@@ -229,7 +229,7 @@ public interface MutableMap</*0*/ K, /*1*/ V> : kotlin.collections.Map<K, V> {
public abstract override /*1*/ /*fake_override*/ fun containsValue(/*0*/ value: V): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun forEach(/*0*/ p0: java.util.function.BiConsumer<in K!, in V!>!): kotlin.Unit
public abstract override /*1*/ /*fake_override*/ fun get(/*0*/ key: K): V?
public open override /*1*/ /*fake_override*/ fun getOrDefault(/*0*/ p0: kotlin.Any!, /*1*/ p1: V!): V!
@kotlin.internal.PlatformDependent() public open override /*1*/ /*fake_override*/ fun getOrDefault(/*0*/ key: K, /*1*/ defaultValue: V): V
public abstract override /*1*/ /*fake_override*/ fun isEmpty(): kotlin.Boolean
public open fun merge(/*0*/ p0: K!, /*1*/ p1: V!, /*2*/ p2: java.util.function.BiFunction<in V!, in V!, out V!>!): V!
public abstract fun put(/*0*/ key: K, /*1*/ value: V): V?