ReplaceJavaStaticMethodWithKotlinAnalogInspection: introduce Transform interface

#KT-32454 Fixed
This commit is contained in:
Dmitry Gridin
2019-07-09 11:53:10 +03:00
parent 835532c206
commit 3aa2401f19
45 changed files with 169 additions and 230 deletions
@@ -0,0 +1,7 @@
// WITH_RUNTIME
import java.util.Arrays.hashCode
fun test() {
val a = arrayOf(1)
val hash = <caret>hashCode(a)
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
import java.util.Arrays.hashCode
fun test() {
val a = arrayOf(1)
val hash = <caret>a.contentHashCode()
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test() {
<caret>System.out.print("foo")
System.out.print<caret>("foo")
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test() {
<caret>System.out.println()
System.out.<caret>println()
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double, y: Double) {
<caret>Math.IEEEremainder(x, y)
Math.<caret>IEEEremainder(x, y)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double) {
<caret>Math.abs(x)
Math.abs<caret>(x)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double) {
<caret>Math.acos(x)
Math.<caret>acos(x)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double) {
<caret>Math.asin(x)
Math.<caret>asin(x)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double) {
<caret>Math.atan(x)
Math.<caret>atan(x)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double, y: Double) {
<caret>Math.atan2(x, y)
Math.<caret>atan2(x, y)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double) {
<caret>Math.ceil(x)
Math.<caret>ceil(x)
}
@@ -1,5 +1,5 @@
// FIX: Replace with `coerceAtLeast` function
// WITH_RUNTIME
fun test(x: Double, y: Double) {
<caret>Math.max(x, y)
Math.<caret>max(x, y)
}
@@ -1,5 +1,5 @@
// FIX: Replace with `coerceAtMost` function
// WITH_RUNTIME
fun test(x: Double, y: Double) {
<caret>Math.min(x, y)
Math.<caret>min(x, y)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double, y: Double) {
<caret>Math.copySign(x, y)
Math.<caret>copySign(x, y)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double) {
<caret>Math.cos(x)
Math.<caret>cos(x)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double) {
<caret>Math.cosh(x)
Math.<caret>cosh(x)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double) {
<caret>Math.exp(x)
Math.<caret>exp(x)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double) {
<caret>Math.expm1(x)
Math.<caret>expm1(x)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double) {
<caret>Math.floor(x)
Math.<caret>floor(x)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double, y: Double) {
<caret>Math.hypot(x, y)
Math.<caret>hypot(x, y)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double) {
<caret>Math.log(x)
Math.<caret>log(x)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double) {
<caret>Math.log10(x)
Math.<caret>log10(x)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double) {
<caret>Math.log1p(x)
Math.<caret>log1p(x)
}
@@ -1,5 +1,5 @@
// FIX: Replace with `max` function
// WITH_RUNTIME
fun test(x: Double, y: Double) {
<caret>Math.max(x, y)
Math.<caret>max(x, y)
}
@@ -1,5 +1,5 @@
// FIX: Replace with `min` function
// WITH_RUNTIME
fun test(x: Double, y: Double) {
<caret>Math.min(x, y)
Math.<caret>min(x, y)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double, y: Double) {
<caret>Math.nextAfter(x, y)
Math.<caret>nextAfter(x, y)
}
@@ -1,4 +1,4 @@
// RUNTIME_WITH_FULL_JDK
fun test(x: Double) {
<caret>Math.nextDown(x)
Math.<caret>nextDown(x)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double) {
<caret>Math.nextUp(x)
Math.<caret>nextUp(x)
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
// PROBLEM: none
fun test(x: Double) {
<caret>Math.abs(x)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double, y: Double) {
<caret>Math.pow(x, y)
Math.<caret>pow(x, y)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double) {
<caret>Math.rint(x)
Math.<caret>rint(x)
}
@@ -1,5 +1,5 @@
// FIX: Replace with `roundToInt` function
// WITH_RUNTIME
fun test(x: Double) {
<caret>Math.round(x)
Math.<caret>round(x)
}
@@ -1,5 +1,5 @@
// FIX: Replace with `roundToLong` function
// WITH_RUNTIME
fun test(x: Double) {
<caret>Math.round(x)
Math.<caret>round(x)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double) {
<caret>Math.signum(x)
Math.<caret>signum(x)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double) {
<caret>Math.sin(x)
Math.<caret>sin(x)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double) {
<caret>Math.sinh(x)
Math.<caret>sinh(x)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double) {
<caret>Math.sqrt(x)
Math.<caret>sqrt(x)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test(x: Double) {
<caret>Math.tan(x)
Math.<caret>tan(x)
}
@@ -1,5 +1,5 @@
// WITH_RUNTIME
// WITH_RUNTIME
fun test(x: Double) {
<caret>Math.tanh(x)
Math.<caret>tanh(x)
}
@@ -1,4 +1,4 @@
// WITH_RUNTIME
fun test() {
<caret>System.exit(0)
System.exit<caret>(0)
}
@@ -2,5 +2,5 @@
fun foo() {
val b = listOf(42, 10)
println(Integer<caret>.toString(b.first(), b.last()).let{it} + 1)
println(Integer.<caret>toString(b.first(), b.last()).let{it} + 1)
}
@@ -1,5 +1,5 @@
// WITH_RUNTIME
fun foo() {
Integer<caret>.toString(42 + 24, 16)
Integer.<caret>toString(42 + 24, 16)
}