K2/Java: implement platform-dependent function filtering in JvmMappedScope

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
This commit is contained in:
Mikhail Glukhikh
2024-01-24 16:50:47 +01:00
committed by Space Team
parent 7d584e0eb4
commit 672b5ba0d7
87 changed files with 352 additions and 373 deletions
@@ -1,9 +1,5 @@
// IGNORE_ANNOTATIONS
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57268 K2: extra methods `remove` and/or `getOrDefault` are generated for Map subclasses with JDK 1.6 in dependencies
// (in this case, it's `getOrDefault-impl` because of inline class mangling, and then `remove` is unmangled for some reason)
inline class InlineMap<K, V>(private val map: Map<K, V>) : Map<K, V> {
override val entries: Set<Map.Entry<K, V>> get() = map.entries
override val keys: Set<K> get() = map.keys
@@ -1,9 +1,5 @@
// IGNORE_ANNOTATIONS
// IGNORE_BACKEND_K2: JVM_IR
// FIR status: KT-57268 K2: extra methods `remove` and/or `getOrDefault` are generated for Map subclasses with JDK 1.6 in dependencies
// (in this case, it's `remove-impl`/`getOrDefault-impl` because of inline class mangling)
inline class InlineMutableMap<K, V>(private val mmap: MutableMap<K, V>) : MutableMap<K, V> {
override val size: Int get() = mmap.size
override fun containsKey(key: K): Boolean = mmap.containsKey(key)