mirror of
https://github.com/github/codeql.git
synced 2026-03-06 07:36:47 +01:00
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:
@@ -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()
|
||||
|
||||
@@ -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; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
| get |
|
||||
| remove |
|
||||
| size |
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
fun f(l: MyList<String>) = l.get(0)
|
||||
@@ -0,0 +1,5 @@
|
||||
import java
|
||||
|
||||
from Method m
|
||||
where m.getDeclaringType().getName().matches("MyList%")
|
||||
select m.toString()
|
||||
Reference in New Issue
Block a user