ReplaceJavaStaticMethodWithKotlinAnalogInspection: introduce Transformation for extension with non-null receiver

This commit is contained in:
Dmitry Gridin
2019-07-09 17:16:11 +03:00
parent d47a7234bb
commit 8b8858b223
7 changed files with 106 additions and 26 deletions
@@ -0,0 +1,8 @@
// WITH_RUNTIME
// PROBLEM: none
import java.util.Arrays
fun test() {
val a: Array<*>? = arrayOf(1)
val str = Arrays.<caret>toString(a)
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val a: Int? = 5
val t: String = Integer.<caret>toString(a)
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val a: Int? = 5
val t: String = a.toString()
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
// PROBLEM: none
// ERROR: Type mismatch: inferred type is Int? but Int was expected
fun foo() {
val a: Int? = 5
val t: String = Integer.<caret>toString(a, 5)
}