JVM_IR: preserve old backend's logic for special mutable collection class stub methods

This commit is contained in:
Jiaxiang Chen
2020-02-28 00:37:34 -08:00
committed by Alexander Udalov
parent da1009eb2c
commit 03613d4708
2 changed files with 13 additions and 2 deletions
@@ -184,8 +184,20 @@ internal class CollectionStubComputer(val context: JvmBackendContext) {
val readOnlyClass: IrClassSymbol,
val mutableClass: IrClassSymbol
) {
// Preserve old backend's logic to generate stubs for special cases where a mutable method
// has the same JVM signature as the immutable method. See KT-36724 for more details.
private val specialCaseStubSignaturesForOldBackend = setOf(
"listIterator()Ljava/util/ListIterator;",
"listIterator(I)Ljava/util/ListIterator;",
"subList(II)Ljava/util/List;"
)
val mutableOnlyMethods: Collection<IrSimpleFunction> by lazy {
val readOnlyMethodSignatures = readOnlyClass.functions.map { getSignature(it.owner) }.toHashSet()
val readOnlyMethodSignatures = readOnlyClass
.functions
.map { getSignature(it.owner) }
.filter { it !in specialCaseStubSignaturesForOldBackend }
.toHashSet()
mutableClass.functions
.map { it.owner }
.filter { getSignature(it) !in readOnlyMethodSignatures }
@@ -1,5 +1,4 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
// FILE: J.java