Skip to content

Commit b79c10c

Browse files
committed
Kotlin: find java-kotlin equivalent functions by erased parameter types
1 parent 64c953b commit b79c10c

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,10 +1277,7 @@ open class KotlinUsesExtractor(
12771277
javaClass.declarations.findSubType<IrFunction> { decl ->
12781278
decl.name.asString() == jvmName &&
12791279
decl.valueParameters.size == f.valueParameters.size &&
1280-
// Note matching by classifier not the whole type so that generic arguments are allowed to differ,
1281-
// as they always will for method type parameters occurring in parameter types (e.g. <T> toArray(T[] array)
1282-
// Differing only by nullability would also be insignificant if it came up.
1283-
decl.valueParameters.zip(f.valueParameters).all { p -> p.first.type.classifierOrNull == p.second.type.classifierOrNull }
1280+
decl.valueParameters.zip(f.valueParameters).all { p -> erase(p.first.type) == erase(p.second.type) }
12841281
} ?:
12851282
// Or if there is none, look for the only viable overload
12861283
javaClass.declarations.singleOrNullSubType<IrFunction> { decl ->
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
diagnostics
2-
| file://:0:0:0:0 | Couldn't find a Java equivalent function to kotlin.collections.MutableList.remove in java.util.List |
32
#select
43
| Integer |
54
| Object |

0 commit comments

Comments
 (0)