Polish KT-22011 inspection: message, level, group, range, etc.
This commit is contained in:
@@ -2624,11 +2624,11 @@
|
||||
/>
|
||||
|
||||
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.JavaCollectionsStaticMethodOnImmutableListInspection"
|
||||
displayName="Immutable Kotlin collection may be changed with Java Collections method"
|
||||
displayName="Call of Java mutator method on immutable Kotlin collection"
|
||||
groupPath="Kotlin"
|
||||
groupName="Probable bugs"
|
||||
groupName="Java interop issues"
|
||||
enabledByDefault="true"
|
||||
level="WEAK WARNING"
|
||||
level="WARNING"
|
||||
language="kotlin"
|
||||
/>
|
||||
|
||||
|
||||
+3
-2
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.idea.inspections
|
||||
|
||||
import com.intellij.codeInspection.ProblemsHolder
|
||||
import com.intellij.psi.PsiElementVisitor
|
||||
import org.jetbrains.kotlin.idea.intentions.callExpression
|
||||
import org.jetbrains.kotlin.psi.dotQualifiedExpressionVisitor
|
||||
|
||||
class JavaCollectionsStaticMethodOnImmutableListInspection : AbstractKotlinInspection() {
|
||||
@@ -14,8 +15,8 @@ class JavaCollectionsStaticMethodOnImmutableListInspection : AbstractKotlinInspe
|
||||
return dotQualifiedExpressionVisitor(fun(expression) {
|
||||
val (methodName, firstArg) = JavaCollectionsStaticMethodInspection.getTargetMethodOnImmutableList(expression) ?: return
|
||||
holder.registerProblem(
|
||||
expression,
|
||||
"The '${firstArg.text}' may be changed with Java Collections method '$methodName'"
|
||||
expression.callExpression?.calleeExpression ?: expression,
|
||||
"Call of Java mutator '$methodName' on immutable Kotlin collection '${firstArg.text}'"
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user