Rename ReplaceJavaStaticMethodWithTopLevelFunctionInspection to ReplaceJavaStaticMethodWithKotlinAnalogInspection
This commit is contained in:
@@ -3378,8 +3378,8 @@
|
|||||||
language="kotlin"
|
language="kotlin"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.ReplaceJavaStaticMethodWithTopLevelFunctionInspection"
|
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.ReplaceJavaStaticMethodWithKotlinAnalogInspection"
|
||||||
displayName="Replace Java static method with Kotlin top-level function"
|
displayName="Replace Java static method with Kotlin analog"
|
||||||
groupPath="Kotlin"
|
groupPath="Kotlin"
|
||||||
groupName="Style issues"
|
groupName="Style issues"
|
||||||
enabledByDefault="true"
|
enabledByDefault="true"
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
<html>
|
<html>
|
||||||
<body>
|
<body>
|
||||||
This inspection reports a Java static method call replaceable by a Kotlin top-level function, e.g. <b>System.out.println()</b>.
|
This inspection reports a Java static method call replaceable by a Kotlin function, e.g. <b>System.out.println()</b>.
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
+3
-3
@@ -34,7 +34,7 @@ import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
|||||||
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
||||||
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
|
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
|
||||||
|
|
||||||
class ReplaceJavaStaticMethodWithTopLevelFunctionInspection : AbstractKotlinInspection() {
|
class ReplaceJavaStaticMethodWithKotlinAnalogInspection : AbstractKotlinInspection() {
|
||||||
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean) = callExpressionVisitor(fun(call) {
|
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean) = callExpressionVisitor(fun(call) {
|
||||||
val callee = call.calleeExpression ?: return
|
val callee = call.calleeExpression ?: return
|
||||||
val dotQualified = call.getStrictParentOfType<KtDotQualifiedExpression>() ?: return
|
val dotQualified = call.getStrictParentOfType<KtDotQualifiedExpression>() ?: return
|
||||||
@@ -50,11 +50,11 @@ class ReplaceJavaStaticMethodWithTopLevelFunctionInspection : AbstractKotlinInsp
|
|||||||
dotQualified,
|
dotQualified,
|
||||||
TextRange(0, callee.endOffset - dotQualified.startOffset),
|
TextRange(0, callee.endOffset - dotQualified.startOffset),
|
||||||
"Should be replaced with '${replacement.kotlinFunctionShortName}()'",
|
"Should be replaced with '${replacement.kotlinFunctionShortName}()'",
|
||||||
ReplaceWithTopLevelFunction(replacements)
|
ReplaceWithKotlinAnalogFunction(replacements)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
private class ReplaceWithTopLevelFunction(private val replacements: List<Replacement>) : LocalQuickFix {
|
private class ReplaceWithKotlinAnalogFunction(private val replacements: List<Replacement>) : LocalQuickFix {
|
||||||
override fun getName() = "Replace with '${replacements.first().kotlinFunctionShortName}()'"
|
override fun getName() = "Replace with '${replacements.first().kotlinFunctionShortName}()'"
|
||||||
|
|
||||||
override fun getFamilyName() = name
|
override fun getFamilyName() = name
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
org.jetbrains.kotlin.idea.inspections.ReplaceJavaStaticMethodWithTopLevelFunctionInspection
|
org.jetbrains.kotlin.idea.inspections.ReplaceJavaStaticMethodWithKotlinAnalogInspection
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user