Inspection to convert Arrays.copyOf(a, size) to a.copyOf(size)

This commit is contained in:
kenji tomita
2018-03-10 05:20:25 +03:00
committed by Nikolay Krasko
parent fc4f7303d3
commit e6de8e9cd3
14 changed files with 171 additions and 0 deletions
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.inspections.ReplaceArraysCopyOfWithCopyOfInspection
@@ -0,0 +1,10 @@
// PROBLEM: none
class A {
fun copyOf(x: Int, y: Int) {
}
}
fun test() {
A().<caret>copyOf(1, 2)
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
import java.util.Arrays
fun test() {
val array = intArrayOf(1, 2, 3)
val result = <caret>Arrays.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)
}