Rename ReplaceJavaStaticMethodWithTopLevelFunctionInspection to ReplaceJavaStaticMethodWithKotlinAnalogInspection
This commit is contained in:
@@ -3378,8 +3378,8 @@
|
||||
language="kotlin"
|
||||
/>
|
||||
|
||||
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.ReplaceJavaStaticMethodWithTopLevelFunctionInspection"
|
||||
displayName="Replace Java static method with Kotlin top-level function"
|
||||
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.ReplaceJavaStaticMethodWithKotlinAnalogInspection"
|
||||
displayName="Replace Java static method with Kotlin analog"
|
||||
groupPath="Kotlin"
|
||||
groupName="Style issues"
|
||||
enabledByDefault="true"
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<html>
|
||||
<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>
|
||||
</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.lazy.BodyResolveMode
|
||||
|
||||
class ReplaceJavaStaticMethodWithTopLevelFunctionInspection : AbstractKotlinInspection() {
|
||||
class ReplaceJavaStaticMethodWithKotlinAnalogInspection : AbstractKotlinInspection() {
|
||||
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean) = callExpressionVisitor(fun(call) {
|
||||
val callee = call.calleeExpression ?: return
|
||||
val dotQualified = call.getStrictParentOfType<KtDotQualifiedExpression>() ?: return
|
||||
@@ -50,11 +50,11 @@ class ReplaceJavaStaticMethodWithTopLevelFunctionInspection : AbstractKotlinInsp
|
||||
dotQualified,
|
||||
TextRange(0, callee.endOffset - dotQualified.startOffset),
|
||||
"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 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