KT-15092 Suppress inspection "use property access syntax" for some getters and fix completion for them
#KT-15092 fixed
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
<orderEntry type="library" scope="PROVIDED" name="java-i18n" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="gradle-and-groovy-plugin" level="project" />
|
||||
<orderEntry type="module" module-name="eval4j" />
|
||||
<orderEntry type="library" name="intellij-core-analysis" level="project" />
|
||||
<orderEntry type="library" exported="" name="intellij-core-analysis" level="project" />
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
|
||||
+4
-2
@@ -78,7 +78,9 @@ abstract class IntentionBasedInspection<TElement : PsiElement>(
|
||||
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean, session: LocalInspectionToolSession): PsiElementVisitor {
|
||||
|
||||
val intentionsAndCheckers = intentionInfos.map {
|
||||
it.intention.constructors.single().call() to it.additionalChecker
|
||||
val instance = it.intention.constructors.single().call()
|
||||
instance.inspection = this
|
||||
instance to it.additionalChecker
|
||||
}
|
||||
val elementType = intentionsAndCheckers.map { it.first.elementType }.distinct().singleOrNull()
|
||||
?: error("$intentionInfos should have the same elementType")
|
||||
@@ -105,7 +107,7 @@ abstract class IntentionBasedInspection<TElement : PsiElement>(
|
||||
if (fixes == null) {
|
||||
fixes = SmartList<LocalQuickFix>()
|
||||
}
|
||||
fixes!!.add(createQuickFix(intention, additionalChecker, targetElement))
|
||||
fixes.add(createQuickFix(intention, additionalChecker, targetElement))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -91,8 +91,11 @@ abstract class SelfTargetingIntention<TElement : PsiElement>(
|
||||
return !isIntentionBaseInspectionEnabled(project, target)
|
||||
}
|
||||
|
||||
var inspection: IntentionBasedInspection<TElement>? = null
|
||||
internal set
|
||||
|
||||
protected fun isIntentionBaseInspectionEnabled(project: Project, target: TElement): Boolean {
|
||||
val inspection = findInspection(this.javaClass.kotlin) ?: return false
|
||||
val inspection = inspection ?: findInspection(this.javaClass.kotlin) ?: return false
|
||||
|
||||
val key = HighlightDisplayKey.find(inspection.shortName)
|
||||
if (!InspectionProjectProfileManager.getInstance(project).inspectionProfile.isToolEnabled(key, target)) {
|
||||
|
||||
Reference in New Issue
Block a user