JVM_IR: preserve old backend's logic for special mutable collection class stub methods
This commit is contained in:
committed by
Alexander Udalov
parent
da1009eb2c
commit
03613d4708
+13
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user