J2K produces unresolved 'toArray' calls for java Collection#toArray(T[])
#KT-11600 Fixed
This commit is contained in:
@@ -41,6 +41,11 @@ enum class SpecialMethod(val qualifiedClassName: String?, val methodName: String
|
||||
= convertWithChangedName("toTypedArray", qualifier, arguments.notNull(), typeArgumentsConverted, codeConverter)
|
||||
},
|
||||
|
||||
COLLECTION_TO_ARRAY_WITH_ARG(Collection::class.java.name, "toArray", 1) {
|
||||
override fun convertCall(qualifier: PsiExpression?, arguments: Array<PsiExpression>, typeArgumentsConverted: List<Type>, codeConverter: CodeConverter)
|
||||
= convertWithChangedName("toTypedArray", qualifier, emptyList(), typeArgumentsConverted, codeConverter)
|
||||
},
|
||||
|
||||
MAP_SIZE(Map::class.java.name, "size", 0) {
|
||||
override fun convertCall(qualifier: PsiExpression?, arguments: Array<PsiExpression>, typeArgumentsConverted: List<Type>, codeConverter: CodeConverter)
|
||||
= convertMethodCallToPropertyUse(codeConverter, qualifier)
|
||||
|
||||
+5
-2
@@ -1,7 +1,10 @@
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class Foo {
|
||||
public Object[] m() {
|
||||
return Arrays.asList("a", "b").toArray();
|
||||
public void test() {
|
||||
List<String> list = Arrays.asList("a", "b");
|
||||
Object[] array1 = list.toArray();
|
||||
Object[] array2 = list.toArray(new String[list.size()]);
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -1,7 +1,9 @@
|
||||
import java.util.Arrays
|
||||
|
||||
class Foo {
|
||||
fun m(): Array<Any> {
|
||||
return Arrays.asList("a", "b").toTypedArray()
|
||||
fun test() {
|
||||
val list = Arrays.asList("a", "b")
|
||||
val array1 = list.toTypedArray()
|
||||
val array2 = list.toTypedArray()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user