Add Java Arrays.asList, Set.of, List.of to ReplaceJavaStaticMethodWithKotlinAnalogInspection

Relates to #KT-27782 #KT-21641
This commit is contained in:
Dmitry Gridin
2019-04-12 12:05:52 +07:00
parent b5b5723ec3
commit ee304e92b5
13 changed files with 80 additions and 13 deletions
@@ -0,0 +1,6 @@
// WITH_RUNTIME
import java.util.Arrays
fun test() {
val a = Arrays.<caret>asList(1, 3, null)
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
import java.util.Arrays
fun test() {
val a = listOf(1, 3, null)
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
import java.util.Arrays
fun test() {
val array = intArrayOf(1, 2, 3)
val result = Arrays.<caret>copyOf(array, 3)
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
import java.util.Arrays
fun test() {
val array = intArrayOf(1, 2, 3)
val result = array.copyOf(3)
}
@@ -0,0 +1,10 @@
// PROBLEM: none
class A {
fun copyOf(x: Int, y: Int) {
}
}
fun test() {
A().<caret>copyOf(1, 2)
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test() {
val array = intArrayOf(1, 2, 3)
val result = java.util.Arrays.<caret>copyOf(array, 3)
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun test() {
val array = intArrayOf(1, 2, 3)
val result = array.copyOf(3)
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
// MIN_JAVA_VERSION: 9
fun test() {
val a = java.util.Set.of<caret><String>()
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
// MIN_JAVA_VERSION: 9
fun test() {
val a = setOf<String>()
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
// MIN_JAVA_VERSION: 9
fun test() {
val a = java.util.Set.of<caret>("sfsf", 25)
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
// MIN_JAVA_VERSION: 9
fun test() {
val a = setOf("sfsf", 25)
}