From 6c7f558d36c56306ead308066d2a7072dc212ab8 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Fri, 6 Oct 2017 19:21:01 +0200 Subject: [PATCH] Add missing FileModificationService call (EA-107395) --- .../idea/inspections/RedundantSamConstructorInspection.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSamConstructorInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSamConstructorInspection.kt index 5d319e323ce..5ba69e823cf 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSamConstructorInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSamConstructorInspection.kt @@ -16,6 +16,7 @@ package org.jetbrains.kotlin.idea.inspections +import com.intellij.codeInsight.FileModificationService import com.intellij.codeInspection.* import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor @@ -58,6 +59,7 @@ class RedundantSamConstructorInspection : AbstractKotlinInspection() { override fun getName() = "Remove redundant SAM-constructor" override fun getFamilyName() = name override fun applyFix(project: Project, descriptor: ProblemDescriptor) { + if (!FileModificationService.getInstance().preparePsiElementForWrite(expression)) return replaceSamConstructorCall(expression) } } @@ -69,6 +71,7 @@ class RedundantSamConstructorInspection : AbstractKotlinInspection() { override fun getFamilyName() = name override fun applyFix(project: Project, descriptor: ProblemDescriptor) { for (callExpression in expressions) { + if (!FileModificationService.getInstance().preparePsiElementForWrite(callExpression)) return replaceSamConstructorCall(callExpression) } }