Added inspection based on ReplaceWithOperatorAssignIntention

This commit is contained in:
Valentin Kipyatkov
2015-04-29 19:09:27 +03:00
parent bab4ae3879
commit 435e9fed3f
3 changed files with 13 additions and 7 deletions
+9 -2
View File
@@ -906,10 +906,17 @@
/> />
<localInspection implementationClass="org.jetbrains.kotlin.idea.intentions.SimplifyBinaryNegationInspection" <localInspection implementationClass="org.jetbrains.kotlin.idea.intentions.SimplifyBinaryNegationInspection"
displayName="Simplify Negated Binary Expression" displayName="Simplify negated binary expression"
groupName="Kotlin" groupName="Kotlin"
enabledByDefault="true" enabledByDefault="true"
level="WARNING" level="WEAK WARNING"
/>
<localInspection implementationClass="org.jetbrains.kotlin.idea.intentions.ReplaceWithOperatorAssignInspection"
displayName="Replace with operator-assignment"
groupName="Kotlin"
enabledByDefault="true"
level="WEAK WARNING"
/> />
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.UnusedSymbolInspection" <localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.UnusedSymbolInspection"
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.idea.util.psi.patternMatching.matches import org.jetbrains.kotlin.idea.util.psi.patternMatching.matches
import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.analyze
public class ReplaceWithOperatorAssignIntention : JetSelfTargetingOffsetIndependentIntention<JetBinaryExpression>(javaClass(), "Replace with an operator-assignment") { public class ReplaceWithOperatorAssignIntention : JetSelfTargetingOffsetIndependentIntention<JetBinaryExpression>(javaClass(), "Replace with operator-assignment") {
override fun isApplicableTo(element: JetBinaryExpression): Boolean { override fun isApplicableTo(element: JetBinaryExpression): Boolean {
if (element.getOperationToken() != JetTokens.EQ) return false if (element.getOperationToken() != JetTokens.EQ) return false
@@ -21,10 +21,7 @@ import org.jetbrains.kotlin.idea.inspections.IntentionBasedInspection
import org.jetbrains.kotlin.idea.intentions.attributeCallReplacements.ReplaceGetIntention import org.jetbrains.kotlin.idea.intentions.attributeCallReplacements.ReplaceGetIntention
import org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.IfThenToElvisIntention import org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.IfThenToElvisIntention
import org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.IfThenToSafeAccessIntention import org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.IfThenToSafeAccessIntention
import org.jetbrains.kotlin.psi.JetDotQualifiedExpression import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.JetIfExpression
import org.jetbrains.kotlin.psi.JetPrefixExpression
import org.jetbrains.kotlin.psi.JetTypeArgumentList
public class ExplicitGetInspection : IntentionBasedInspection<JetDotQualifiedExpression>(ReplaceGetIntention()) public class ExplicitGetInspection : IntentionBasedInspection<JetDotQualifiedExpression>(ReplaceGetIntention())
@@ -41,3 +38,5 @@ public class RemoveExplicitTypeArgsInspection : IntentionBasedInspection<JetType
public class SimplifyBinaryNegationInspection : IntentionBasedInspection<JetPrefixExpression>(SimplifyNegatedBinaryExpressionIntention()) public class SimplifyBinaryNegationInspection : IntentionBasedInspection<JetPrefixExpression>(SimplifyNegatedBinaryExpressionIntention())
public class ReplaceWithOperatorAssignInspection : IntentionBasedInspection<JetBinaryExpression>(ReplaceWithOperatorAssignIntention())