Skip to content

Commit d151bf6

Browse files
committed
Kotlin: Rewrite MutableList.removeAt(int) -> remove(int)
The Kotlin authors changed this to avoid a clash on List<Int>, but we must reverse the renaming so the Kotlin and Java views of the same class file extract alike.
1 parent d05e0e9 commit d151bf6

File tree

5 files changed

+24
-1
lines changed

5 files changed

+24
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ open class KotlinUsesExtractor(
8383
makeDescription(StandardNames.FqNames.map, "<get-values>") to "values",
8484
makeDescription(FqName("java.util.Map"), "<get-values>") to "values",
8585
makeDescription(StandardNames.FqNames.map, "<get-entries>") to "entrySet",
86-
makeDescription(FqName("java.util.Map"), "<get-entries>") to "entrySet"
86+
makeDescription(FqName("java.util.Map"), "<get-entries>") to "entrySet",
87+
makeDescription(StandardNames.FqNames.mutableList, "removeAt") to "remove",
88+
makeDescription(FqName("java.util.List"), "removeAt") to "remove"
8789
)
8890

8991
private val specialFunctionShortNames = specialFunctions.keys.map { it.functionName }.toSet()
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import java.util.AbstractList;
2+
3+
public class MyList<T> extends AbstractList<T> {
4+
5+
public T get(int idx) { return null; }
6+
7+
public T remove(int idx) { return null; }
8+
9+
public int size() { return 0; }
10+
11+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
| get |
2+
| remove |
3+
| size |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
fun f(l: MyList<String>) = l.get(0)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import java
2+
3+
from Method m
4+
where m.getDeclaringType().getName().matches("MyList%")
5+
select m.toString()

0 commit comments

Comments
 (0)