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.
This commit is contained in:
Chris Smowton
2022-06-14 16:42:33 +01:00
parent d05e0e9516
commit d151bf632c
5 changed files with 24 additions and 1 deletions

View File

@@ -83,7 +83,9 @@ open class KotlinUsesExtractor(
makeDescription(StandardNames.FqNames.map, "<get-values>") to "values",
makeDescription(FqName("java.util.Map"), "<get-values>") to "values",
makeDescription(StandardNames.FqNames.map, "<get-entries>") to "entrySet",
makeDescription(FqName("java.util.Map"), "<get-entries>") to "entrySet"
makeDescription(FqName("java.util.Map"), "<get-entries>") to "entrySet",
makeDescription(StandardNames.FqNames.mutableList, "removeAt") to "remove",
makeDescription(FqName("java.util.List"), "removeAt") to "remove"
)
private val specialFunctionShortNames = specialFunctions.keys.map { it.functionName }.toSet()

View File

@@ -0,0 +1,11 @@
import java.util.AbstractList;
public class MyList<T> extends AbstractList<T> {
public T get(int idx) { return null; }
public T remove(int idx) { return null; }
public int size() { return 0; }
}

View File

@@ -0,0 +1,3 @@
| get |
| remove |
| size |

View File

@@ -0,0 +1,2 @@
fun f(l: MyList<String>) = l.get(0)

View File

@@ -0,0 +1,5 @@
import java
from Method m
where m.getDeclaringType().getName().matches("MyList%")
select m.toString()