672b5ba0d7
We drop Kotlin function 'remove' or 'getOrDefault' from JvmMappedScope, if it has platform-dependent annotation, and the bound Java class scope does not contain a function with the same signature. #KT-57268 Fixed
44 lines
1.0 KiB
Kotlin
Vendored
44 lines
1.0 KiB
Kotlin
Vendored
// FULL_JDK
|
|
// SCOPE_DUMP: SomeMap:containsKey;containsValue;get;remove, MyMap:containsKey;containsValue;get
|
|
|
|
// FILE: MyBaseMap.java
|
|
public interface MyBaseMap<K1, V1> {
|
|
boolean containsKey(Object key);
|
|
}
|
|
|
|
// FILE: MyMap.java
|
|
public interface MyMap<K2, V2> extends MyBaseMap<K2, V2> {
|
|
@Override
|
|
boolean containsKey(Object key);
|
|
boolean containsValue(Object key);
|
|
|
|
V2 get(K2 key);
|
|
}
|
|
|
|
// FILE: SomeMap.java
|
|
import java.util.Map;
|
|
|
|
public abstract class SomeMap<K3, V3> implements Map<K3, V3>, MyMap<K3, V3> {
|
|
@Override
|
|
public abstract boolean containsKey(Object key);
|
|
|
|
@Override
|
|
public abstract V3 remove(Object key);
|
|
}
|
|
|
|
// FILE: main.kt
|
|
|
|
fun test(map: SomeMap<Int, String>) {
|
|
map.containsKey(1) // ok
|
|
map.containsKey(<!ARGUMENT_TYPE_MISMATCH!>""<!>) // error
|
|
|
|
map.containsValue("") // ok
|
|
map.containsValue(<!ARGUMENT_TYPE_MISMATCH!>1<!>) // error
|
|
|
|
map.get(1) // ok
|
|
map.get(<!ARGUMENT_TYPE_MISMATCH!>""<!>) // error
|
|
|
|
map.remove(1) // ok
|
|
map.remove(<!ARGUMENT_TYPE_MISMATCH!>""<!>) // error
|
|
}
|