From acd8edaa9c14117e31782d8bda9427111839e26d Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 20 Feb 2018 19:38:23 +0300 Subject: [PATCH] WEAK_WARNING -> GENERIC_ERROR_OR_WARNING in three inspections Now there inspection use configured highlight level instead of forced weak warning: null check to safe call, reformat, sort modifiers --- .../NullChecksToSafeCallInspection.kt | 16 +++++++++------- .../idea/inspections/ReformatInspection.kt | 12 +++++++----- .../idea/inspections/SortModifiersInspection.kt | 2 +- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/NullChecksToSafeCallInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/NullChecksToSafeCallInspection.kt index 83f69012591..586ca7b8eba 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/NullChecksToSafeCallInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/NullChecksToSafeCallInspection.kt @@ -20,14 +20,16 @@ import org.jetbrains.kotlin.types.TypeUtils class NullChecksToSafeCallInspection : AbstractKotlinInspection() { override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean, session: LocalInspectionToolSession) = - binaryExpressionVisitor { expression -> - if (isNullChecksToSafeCallFixAvailable(expression)) { - holder.registerProblem(expression, - "Null-checks replaceable with safe-calls", - ProblemHighlightType.WEAK_WARNING, - NullChecksToSafeCallCheckFix()) - } + binaryExpressionVisitor { expression -> + if (isNullChecksToSafeCallFixAvailable(expression)) { + holder.registerProblem( + expression, + "Null-checks replaceable with safe-calls", + ProblemHighlightType.GENERIC_ERROR_OR_WARNING, + NullChecksToSafeCallCheckFix() + ) } + } private class NullChecksToSafeCallCheckFix : LocalQuickFix { override fun getName() = "Replace chained null-checks with safe-calls" diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ReformatInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ReformatInspection.kt index b7e4c7b98fc..4641525b27b 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ReformatInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ReformatInspection.kt @@ -52,11 +52,13 @@ class ReformatInspection : LocalInspectionTool() { }.filterNotNull() return elements.map { - ProblemDescriptorImpl(it, it, - "File is not properly formatted", - arrayOf(ReformatQuickFix), - ProblemHighlightType.WEAK_WARNING, false, null, - isOnTheFly) + ProblemDescriptorImpl( + it, it, + "File is not properly formatted", + arrayOf(ReformatQuickFix), + ProblemHighlightType.GENERIC_ERROR_OR_WARNING, false, null, + isOnTheFly + ) }.toTypedArray() } diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/SortModifiersInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/SortModifiersInspection.kt index 433b410c2ce..ff032429b37 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/SortModifiersInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/SortModifiersInspection.kt @@ -44,7 +44,7 @@ class SortModifiersInspection : AbstractKotlinInspection(), CleanupLocalInspecti holder.registerProblem( list, message, - ProblemHighlightType.WEAK_WARNING, + ProblemHighlightType.GENERIC_ERROR_OR_WARNING, SortModifiersFix(sortedModifiers) ) }