Polish KT-22011 inspection: message, level, group, range, etc.

This commit is contained in:
Mikhail Glukhikh
2018-02-28 12:10:24 +03:00
parent 7d6cb7805c
commit 664a25ce81
4 changed files with 10 additions and 8 deletions
+3 -3
View File
@@ -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"
/>
@@ -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}'"
)
})
}