@@ -1191,20 +1191,22 @@ open class KotlinUsesExtractor(
11911191 else
11921192 f.parentClassOrNull?.let { parentClass ->
11931193 getJavaEquivalentClass(parentClass)?.let { javaClass ->
1194- if (javaClass != parentClass)
1194+ if (javaClass != parentClass) {
1195+ val jvmName = getSpecialJvmName(f) ? : f.name.asString()
11951196 // Look for an exact type match...
11961197 javaClass.declarations.findSubType<IrFunction > { decl ->
1197- decl.name == f.name &&
1198- decl.valueParameters.size == f.valueParameters.size &&
1199- // Note matching by classifier not the whole type so that generic arguments are allowed to differ,
1200- // as they always will for method type parameters occurring in parameter types (e.g. <T> toArray(T[] array)
1201- // Differing only by nullability would also be insignificant if it came up.
1202- decl.valueParameters.zip(f.valueParameters).all { p -> p.first.type.classifierOrNull == p.second.type.classifierOrNull }
1198+ decl.name.asString() == jvmName &&
1199+ decl.valueParameters.size == f.valueParameters.size &&
1200+ // Note matching by classifier not the whole type so that generic arguments are allowed to differ,
1201+ // as they always will for method type parameters occurring in parameter types (e.g. <T> toArray(T[] array)
1202+ // Differing only by nullability would also be insignificant if it came up.
1203+ decl.valueParameters.zip(f.valueParameters)
1204+ .all { p -> p.first.type.classifierOrNull == p.second.type.classifierOrNull }
12031205 } ? :
12041206 // Or if there is none, look for the only viable overload
12051207 javaClass.declarations.singleOrNullSubType<IrFunction > { decl ->
1206- decl.name == f.name &&
1207- decl.valueParameters.size == f.valueParameters.size
1208+ decl.name.asString() == jvmName &&
1209+ decl.valueParameters.size == f.valueParameters.size
12081210 } ? :
12091211 // Or check property accessors:
12101212 (f.propertyIfAccessor as ? IrProperty )?.let { kotlinProp ->
@@ -1223,6 +1225,7 @@ open class KotlinUsesExtractor(
12231225 }
12241226 null
12251227 }
1228+ }
12261229 else
12271230 null
12281231 }
0 commit comments