diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/CanBeParameterInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/CanBeParameterInspection.kt index cda5bde6eae6..e251b2552cb2 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/CanBeParameterInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/CanBeParameterInspection.kt @@ -3,7 +3,10 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.codeInsight.intention.FileModifier -import com.intellij.codeInspection.* +import com.intellij.codeInspection.CleanupLocalInspectionTool +import com.intellij.codeInspection.LocalQuickFix +import com.intellij.codeInspection.ProblemDescriptor +import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import com.intellij.psi.PsiElement import com.intellij.psi.PsiElementVisitor @@ -99,7 +102,6 @@ class CanBeParameterInspection : AbstractKotlinInspection(), CleanupLocalInspect holder.registerProblem( valOrVar, KotlinBundle.message("constructor.parameter.is.never.used.as.a.property"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, RemoveValVarFix(parameter) ) }) diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/ExplicitThisInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/ExplicitThisInspection.kt index bb447deae293..c22adf09ad10 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/ExplicitThisInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/ExplicitThisInspection.kt @@ -1,10 +1,9 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.kotlin.idea.inspections import com.intellij.codeInspection.LocalQuickFix import com.intellij.codeInspection.ProblemDescriptor -import com.intellij.codeInspection.ProblemHighlightType.LIKE_UNUSED_SYMBOL import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import org.jetbrains.kotlin.descriptors.FunctionDescriptor @@ -30,7 +29,6 @@ class ExplicitThisInspection : AbstractKotlinInspection() { holder.registerProblem( thisExpression, KotlinBundle.message("redundant.explicit.this"), - LIKE_UNUSED_SYMBOL, ExplicitThisExpressionFix(thisExpression.text) ) } diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinRedundantOverrideInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinRedundantOverrideInspection.kt index f65bd2fe442b..cc7e5faecf3f 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinRedundantOverrideInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinRedundantOverrideInspection.kt @@ -81,7 +81,7 @@ class KotlinRedundantOverrideInspection : AbstractKotlinInspection(), CleanupLoc function, TextRange(modifierList.startOffsetInParent, funKeyword.endOffset - function.startOffset), KotlinBundle.message("redundant.overriding.method"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, + ProblemHighlightType.GENERIC_ERROR_OR_WARNING, isOnTheFly, RedundantOverrideFix() ) diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinUnusedImportInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinUnusedImportInspection.kt index 9eaa857b664a..4ab47596bc32 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinUnusedImportInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinUnusedImportInspection.kt @@ -121,7 +121,7 @@ class KotlinUnusedImportInspection : AbstractKotlinInspection() { KotlinBundle.message("unused.import.directive"), isOnTheFly, fixes.toTypedArray(), - ProblemHighlightType.LIKE_UNUSED_SYMBOL + ProblemHighlightType.GENERIC_ERROR_OR_WARNING ) } diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantCompanionReferenceInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantCompanionReferenceInspection.kt index 34191484b29a..19733710e2d7 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantCompanionReferenceInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantCompanionReferenceInspection.kt @@ -2,7 +2,10 @@ package org.jetbrains.kotlin.idea.inspections -import com.intellij.codeInspection.* +import com.intellij.codeInspection.CleanupLocalInspectionTool +import com.intellij.codeInspection.LocalQuickFix +import com.intellij.codeInspection.ProblemDescriptor +import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.descriptors.* @@ -42,7 +45,6 @@ class RedundantCompanionReferenceInspection : AbstractKotlinInspection(), Cleanu holder.registerProblem( expression, KotlinBundle.message("redundant.companion.reference"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, RemoveRedundantCompanionReferenceFix() ) } diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantElvisReturnNullInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantElvisReturnNullInspection.kt index fc2c7817455d..74cc45d06d86 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantElvisReturnNullInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantElvisReturnNullInspection.kt @@ -29,7 +29,7 @@ class RedundantElvisReturnNullInspection : AbstractKotlinInspection(), CleanupLo holder.registerProblem( binaryExpression, KotlinBundle.message("inspection.redundant.elvis.return.null.descriptor"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, + ProblemHighlightType.GENERIC_ERROR_OR_WARNING, TextRange(binaryExpression.operationReference.startOffset, right.endOffset).shiftLeft(binaryExpression.startOffset), RemoveRedundantElvisReturnNull() ) diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantEmptyInitializerBlockInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantEmptyInitializerBlockInspection.kt index 0aacd8234751..7b090165ebcb 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantEmptyInitializerBlockInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantEmptyInitializerBlockInspection.kt @@ -16,7 +16,7 @@ class RedundantEmptyInitializerBlockInspection : AbstractKotlinInspection(), Cle holder.registerProblem( initializer, KotlinBundle.message("redundant.empty.initializer.block"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, + ProblemHighlightType.GENERIC_ERROR_OR_WARNING, RemoveInitializerBlockFix() ) }) diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantEnumConstructorInvocationInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantEnumConstructorInvocationInspection.kt index c44952c78303..05631ef0a986 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantEnumConstructorInvocationInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantEnumConstructorInvocationInspection.kt @@ -2,7 +2,10 @@ package org.jetbrains.kotlin.idea.inspections -import com.intellij.codeInspection.* +import com.intellij.codeInspection.CleanupLocalInspectionTool +import com.intellij.codeInspection.LocalQuickFix +import com.intellij.codeInspection.ProblemDescriptor +import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import org.jetbrains.kotlin.diagnostics.Severity import org.jetbrains.kotlin.idea.KotlinBundle @@ -21,7 +24,6 @@ class RedundantEnumConstructorInvocationInspection : AbstractKotlinInspection(), holder.registerProblem( valueArgumentList, KotlinBundle.message("redundant.enum.constructor.invocation"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, RemoveEnumConstructorInvocationFix() ) }) diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantExplicitTypeInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantExplicitTypeInspection.kt index 3581685f8c13..f4c2b9acbac1 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantExplicitTypeInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantExplicitTypeInspection.kt @@ -4,7 +4,6 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.codeInspection.CleanupLocalInspectionTool import com.intellij.codeInspection.IntentionWrapper -import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import org.jetbrains.kotlin.KtNodeTypes import org.jetbrains.kotlin.builtins.KotlinBuiltIns @@ -27,7 +26,6 @@ class RedundantExplicitTypeInspection : AbstractKotlinInspection(), CleanupLocal holder.registerProblem( typeReference, KotlinBundle.message("explicitly.given.type.is.redundant.here"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, IntentionWrapper(RemoveExplicitTypeIntention()) ) } diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantInnerClassModifierInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantInnerClassModifierInspection.kt index 07c24b0de381..dbc315cf01c9 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantInnerClassModifierInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantInnerClassModifierInspection.kt @@ -38,6 +38,7 @@ import org.jetbrains.kotlin.utils.addToStdlib.safeAs import javax.swing.JPanel class RedundantInnerClassModifierInspection : AbstractKotlinInspection(), CleanupLocalInspectionTool { + @Suppress("MemberVisibilityCanBePrivate") var ignorableAnnotations = OrderedSet(listOf(JUnitCommonClassNames.ORG_JUNIT_JUPITER_API_NESTED)) override fun createOptionsPanel(): JPanel = SpecialAnnotationsUtil.createSpecialAnnotationsListControl( @@ -55,7 +56,6 @@ class RedundantInnerClassModifierInspection : AbstractKotlinInspection(), Cleanu holder.registerProblem( innerModifier, KotlinBundle.message("inspection.redundant.inner.class.modifier.descriptor"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, RemoveInnerModifierFix() ) }) diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantLambdaArrowInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantLambdaArrowInspection.kt index 48956a3aeabc..b04f1b885892 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantLambdaArrowInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantLambdaArrowInspection.kt @@ -65,7 +65,7 @@ class RedundantLambdaArrowInspection : AbstractKotlinInspection(), CleanupLocalI functionLiteral, TextRange((singleParameter?.startOffset ?: arrow.startOffset) - startOffset, arrow.endOffset - startOffset), KotlinBundle.message("redundant.lambda.arrow"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, + ProblemHighlightType.GENERIC_ERROR_OR_WARNING, isOnTheFly, DeleteFix() ) diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantModalityModifierInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantModalityModifierInspection.kt index b9504e3c96f1..dd89b8b28782 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantModalityModifierInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantModalityModifierInspection.kt @@ -1,8 +1,11 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.kotlin.idea.inspections -import com.intellij.codeInspection.* +import com.intellij.codeInspection.CleanupLocalInspectionTool +import com.intellij.codeInspection.IntentionWrapper +import com.intellij.codeInspection.LocalInspectionToolSession +import com.intellij.codeInspection.ProblemsHolder import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.core.implicitModality @@ -22,7 +25,6 @@ class RedundantModalityModifierInspection : AbstractKotlinInspection(), CleanupL holder.registerProblem( modalityModifier, KotlinBundle.message("redundant.modality.modifier"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, IntentionWrapper(RemoveModifierFix(declaration, implicitModality, isRedundant = true)) ) } diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantReturnLabelInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantReturnLabelInspection.kt index 871b5004236c..5ffb8aebf90d 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantReturnLabelInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantReturnLabelInspection.kt @@ -4,7 +4,6 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.codeInspection.CleanupLocalInspectionTool import com.intellij.codeInspection.IntentionWrapper -import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.idea.KotlinBundle @@ -24,7 +23,6 @@ class RedundantReturnLabelInspection : AbstractKotlinInspection(), CleanupLocalI holder.registerProblem( label, KotlinBundle.message("redundant.0", labelName), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, IntentionWrapper(RemoveReturnLabelFix(returnExpression, labelName)), ) }, diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSemicolonInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSemicolonInspection.kt index 833ecd5ed01c..0560279527b5 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSemicolonInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSemicolonInspection.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.kotlin.idea.inspections @@ -28,7 +28,6 @@ class RedundantSemicolonInspection : AbstractKotlinInspection(), CleanupLocalIns holder.registerProblem( element, KotlinBundle.message("redundant.semicolon"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, Fix ) } diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSuspendModifierInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSuspendModifierInspection.kt index 709373dcd8b2..7bdae12a45fd 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSuspendModifierInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSuspendModifierInspection.kt @@ -2,7 +2,10 @@ package org.jetbrains.kotlin.idea.inspections -import com.intellij.codeInspection.* +import com.intellij.codeInspection.CleanupLocalInspectionTool +import com.intellij.codeInspection.IntentionWrapper +import com.intellij.codeInspection.LocalInspectionToolSession +import com.intellij.codeInspection.ProblemsHolder import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.descriptors.Modality @@ -43,7 +46,6 @@ class RedundantSuspendModifierInspection : AbstractKotlinInspection(), CleanupLo holder.registerProblem( suspendModifier, KotlinBundle.message("redundant.suspend.modifier"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, IntentionWrapper(RemoveModifierFixBase(function, KtTokens.SUSPEND_KEYWORD, isRedundant = true)) ) }) diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantUnitExpressionInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantUnitExpressionInspection.kt index 39226a6f069b..378d37439f0b 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantUnitExpressionInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantUnitExpressionInspection.kt @@ -1,8 +1,11 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.kotlin.idea.inspections -import com.intellij.codeInspection.* +import com.intellij.codeInspection.CleanupLocalInspectionTool +import com.intellij.codeInspection.LocalQuickFix +import com.intellij.codeInspection.ProblemDescriptor +import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.builtins.StandardNames @@ -32,7 +35,6 @@ class RedundantUnitExpressionInspection : AbstractKotlinInspection(), CleanupLoc holder.registerProblem( expression, KotlinBundle.message("redundant.unit"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, RemoveRedundantUnitFix() ) } diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantUnitReturnTypeInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantUnitReturnTypeInspection.kt index 04ff26e7b443..ce8119f052a6 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantUnitReturnTypeInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantUnitReturnTypeInspection.kt @@ -1,10 +1,9 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.kotlin.idea.inspections import com.intellij.codeInspection.CleanupLocalInspectionTool import com.intellij.codeInspection.IntentionWrapper -import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.idea.KotlinBundle @@ -24,7 +23,6 @@ class RedundantUnitReturnTypeInspection : AbstractKotlinInspection(), CleanupLoc holder.registerProblem( typeElement, KotlinBundle.message("redundant.unit.return.type"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, IntentionWrapper(RemoveExplicitTypeIntention()) ) } diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantVisibilityModifierInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantVisibilityModifierInspection.kt index 5dc463048042..4781315f0bc7 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantVisibilityModifierInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantVisibilityModifierInspection.kt @@ -1,14 +1,13 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.kotlin.idea.inspections -import com.intellij.codeInspection.* +import com.intellij.codeInspection.CleanupLocalInspectionTool +import com.intellij.codeInspection.IntentionWrapper +import com.intellij.codeInspection.LocalInspectionToolSession +import com.intellij.codeInspection.ProblemsHolder import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.config.AnalysisFlags -import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor -import org.jetbrains.kotlin.descriptors.PropertyDescriptor -import org.jetbrains.kotlin.descriptors.DescriptorVisibilities -import org.jetbrains.kotlin.descriptors.DescriptorVisibility import org.jetbrains.kotlin.config.ExplicitApiMode import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.idea.KotlinBundle @@ -58,7 +57,6 @@ class RedundantVisibilityModifierInspection : AbstractKotlinInspection(), Cleanu holder.registerProblem( visibilityModifier, KotlinBundle.message("redundant.visibility.modifier"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, IntentionWrapper(RemoveModifierFix(declaration, redundantVisibility, isRedundant = true)) ) }) diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantWithInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantWithInspection.kt index e50f0042e38c..e6a6e2a79e54 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantWithInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantWithInspection.kt @@ -2,7 +2,10 @@ package org.jetbrains.kotlin.idea.inspections -import com.intellij.codeInspection.* +import com.intellij.codeInspection.CleanupLocalInspectionTool +import com.intellij.codeInspection.LocalQuickFix +import com.intellij.codeInspection.ProblemDescriptor +import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.idea.KotlinBundle @@ -64,7 +67,6 @@ class RedundantWithInspection : AbstractKotlinInspection(), CleanupLocalInspecti holder.registerProblem( callee, KotlinBundle.message("inspection.redundant.with.display.name"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, quickfix ) } diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveEmptyParenthesesFromAnnotationEntryInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveEmptyParenthesesFromAnnotationEntryInspection.kt index 361f6e432de2..1ea1d65d1a14 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveEmptyParenthesesFromAnnotationEntryInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveEmptyParenthesesFromAnnotationEntryInspection.kt @@ -2,7 +2,10 @@ package org.jetbrains.kotlin.idea.inspections -import com.intellij.codeInspection.* +import com.intellij.codeInspection.CleanupLocalInspectionTool +import com.intellij.codeInspection.LocalQuickFix +import com.intellij.codeInspection.ProblemDescriptor +import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor @@ -33,7 +36,6 @@ class RemoveEmptyParenthesesFromAnnotationEntryInspection : AbstractKotlinInspec holder.registerProblem( list, KotlinBundle.message("parentheses.should.be.removed"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, RemoveEmptyParenthesesFromAnnotationEntryFix() ) }) diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantQualifierNameInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantQualifierNameInspection.kt index 24ca641aa5f5..2728f2cd48f1 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantQualifierNameInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantQualifierNameInspection.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.kotlin.idea.inspections @@ -14,7 +14,7 @@ import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyzeAsReplacement -import org.jetbrains.kotlin.idea.caches.resolve.analyze +import org.jetbrains.kotlin.idea.caches.resolve.safeAnalyzeNonSourceRootCode import org.jetbrains.kotlin.idea.core.ShortenReferences import org.jetbrains.kotlin.idea.core.compareDescriptors import org.jetbrains.kotlin.idea.core.unwrapIfFakeOverride @@ -22,7 +22,6 @@ import org.jetbrains.kotlin.idea.imports.importableFqName import org.jetbrains.kotlin.idea.intentions.isReferenceToBuiltInEnumFunction import org.jetbrains.kotlin.idea.references.mainReference import org.jetbrains.kotlin.idea.references.resolveToDescriptors -import org.jetbrains.kotlin.idea.caches.resolve.safeAnalyzeNonSourceRootCode import org.jetbrains.kotlin.idea.util.getResolutionScope import org.jetbrains.kotlin.idea.util.hasNotReceiver import org.jetbrains.kotlin.incremental.components.NoLookupLocation @@ -196,7 +195,7 @@ private fun reportProblem(holder: ProblemsHolder, element: KtElement) { holder.registerProblem( element, KotlinBundle.message("redundant.qualifier.name"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, + ProblemHighlightType.GENERIC_ERROR_OR_WARNING, TextRange.from(firstChild.startOffsetInParent, firstChild.textLength + 1), RemoveRedundantQualifierNameQuickFix() ) diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantSpreadOperatorInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantSpreadOperatorInspection.kt index 2cbdc0ba3dce..f618246dc517 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantSpreadOperatorInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantSpreadOperatorInspection.kt @@ -55,7 +55,7 @@ class RemoveRedundantSpreadOperatorInspection : AbstractKotlinInspection(), Clea argument, TextRange(startOffset, endOffset), KotlinBundle.message("remove.redundant.spread.operator.quickfix.text"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, + ProblemHighlightType.GENERIC_ERROR_OR_WARNING, isOnTheFly, RemoveRedundantSpreadOperatorQuickfix() ) diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveSetterParameterTypeInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveSetterParameterTypeInspection.kt index b0350d1dd535..ff3151d75692 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveSetterParameterTypeInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveSetterParameterTypeInspection.kt @@ -4,7 +4,6 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.codeInspection.CleanupLocalInspectionTool import com.intellij.codeInspection.IntentionWrapper -import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.idea.KotlinBundle @@ -23,7 +22,6 @@ class RemoveSetterParameterTypeInspection : AbstractKotlinInspection(), CleanupL holder.registerProblem( typeReference, KotlinBundle.message("redundant.setter.parameter.type"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, IntentionWrapper(RemoveExplicitTypeIntention()) ) } diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveToStringInStringTemplateInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveToStringInStringTemplateInspection.kt index 71010cccb19b..67c549167342 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveToStringInStringTemplateInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveToStringInStringTemplateInspection.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.kotlin.idea.inspections @@ -20,7 +20,6 @@ class RemoveToStringInStringTemplateInspection : AbstractKotlinInspection(), Cle holder.registerProblem( selectorExpression, KotlinBundle.message("redundant.tostring.call.in.string.template"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, RemoveToStringFix() ) }) diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/UnnecessaryOptInAnnotationInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/UnnecessaryOptInAnnotationInspection.kt index 4578ff10b653..f28426ec1f16 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/UnnecessaryOptInAnnotationInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/UnnecessaryOptInAnnotationInspection.kt @@ -1,7 +1,10 @@ // Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.kotlin.idea.inspections -import com.intellij.codeInspection.* +import com.intellij.codeInspection.CleanupLocalInspectionTool +import com.intellij.codeInspection.LocalQuickFix +import com.intellij.codeInspection.ProblemDescriptor +import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor import com.intellij.psi.SmartPsiElementPointer @@ -126,7 +129,6 @@ class UnnecessaryOptInAnnotationInspection : AbstractKotlinInspection(), Cleanup holder.registerProblem( annotationEntry, KotlinBundle.message("inspection.unnecessary.opt_in.redundant.annotation"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, RemoveAnnotationEntry() ) } else { @@ -140,7 +142,6 @@ class UnnecessaryOptInAnnotationInspection : AbstractKotlinInspection(), Cleanup "inspection.unnecessary.opt_in.redundant.marker", marker.fqName.shortName().render() ), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, RemoveAnnotationArgumentOrEntireEntry() ) } diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedMainParameterInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedMainParameterInspection.kt index d2557ced9b97..3ab1275170ab 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedMainParameterInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedMainParameterInspection.kt @@ -1,10 +1,9 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.kotlin.idea.inspections import com.intellij.codeInspection.IntentionWrapper import com.intellij.codeInspection.LocalInspectionToolSession -import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithContent @@ -25,7 +24,6 @@ class UnusedMainParameterInspection : AbstractKotlinInspection() { holder.registerProblem( parameter, KotlinBundle.message("since.kotlin.1.3.main.parameter.is.not.necessary"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, IntentionWrapper(RemoveUnusedFunctionParameterFix(parameter)) ) } diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedReceiverParameterInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedReceiverParameterInspection.kt index a3b878b419aa..65442ada3a89 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedReceiverParameterInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedReceiverParameterInspection.kt @@ -110,7 +110,6 @@ class UnusedReceiverParameterInspection : AbstractKotlinInspection(), CleanupLoc holder.registerProblem( receiverTypeReference, KotlinBundle.message("inspection.unused.receiver.parameter"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, RemoveReceiverFix(inSameClass) ) } diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedSymbolInspection.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedSymbolInspection.kt index af96e23b2f7a..753e01a5eecd 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedSymbolInspection.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedSymbolInspection.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.kotlin.idea.inspections @@ -39,6 +39,8 @@ import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.base.projectStructure.RootKindFilter import org.jetbrains.kotlin.idea.base.projectStructure.languageVersionSettings import org.jetbrains.kotlin.idea.base.projectStructure.matches +import org.jetbrains.kotlin.idea.base.projectStructure.scope.KotlinSourceFilterScope +import org.jetbrains.kotlin.idea.base.util.projectScope import org.jetbrains.kotlin.idea.caches.project.implementingDescriptors import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.findModuleDescriptor @@ -61,8 +63,6 @@ import org.jetbrains.kotlin.idea.search.ideaExtensions.KotlinReferencesSearchPar import org.jetbrains.kotlin.idea.search.isCheapEnoughToSearchConsideringOperators import org.jetbrains.kotlin.idea.search.usagesSearch.getClassNameForCompanionObject import org.jetbrains.kotlin.idea.search.usagesSearch.isDataClassProperty -import org.jetbrains.kotlin.idea.base.projectStructure.scope.KotlinSourceFilterScope -import org.jetbrains.kotlin.idea.base.util.projectScope import org.jetbrains.kotlin.idea.util.hasActualsFor import org.jetbrains.kotlin.js.resolve.diagnostics.findPsi import org.jetbrains.kotlin.lexer.KtTokens @@ -299,7 +299,7 @@ class UnusedSymbolInspection : AbstractKotlinInspection() { psiElement, null, message, - ProblemHighlightType.LIKE_UNUSED_SYMBOL, + ProblemHighlightType.GENERIC_ERROR_OR_WARNING, true, *createQuickFixes(declaration).toTypedArray() ) diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveEmptyClassBodyIntention.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveEmptyClassBodyIntention.kt index 75a006fd179b..58882b2fc5da 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveEmptyClassBodyIntention.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveEmptyClassBodyIntention.kt @@ -1,9 +1,8 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.kotlin.idea.intentions import com.intellij.codeInspection.CleanupLocalInspectionTool -import com.intellij.codeInspection.ProblemHighlightType import com.intellij.openapi.editor.Editor import com.intellij.psi.PsiElement import org.jetbrains.kotlin.idea.KotlinBundle @@ -17,8 +16,6 @@ import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType @Suppress("DEPRECATION") class RemoveEmptyClassBodyInspection : IntentionBasedInspection(RemoveEmptyClassBodyIntention::class), CleanupLocalInspectionTool { - override fun problemHighlightType(element: KtClassBody): ProblemHighlightType = ProblemHighlightType.LIKE_UNUSED_SYMBOL - override fun inspectionProblemText(element: KtClassBody): String { return KotlinBundle.message("redundant.empty.class.body") } diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveEmptyParenthesesFromLambdaCallIntention.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveEmptyParenthesesFromLambdaCallIntention.kt index 2f0d5738335b..26b80844feff 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveEmptyParenthesesFromLambdaCallIntention.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveEmptyParenthesesFromLambdaCallIntention.kt @@ -1,9 +1,8 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.kotlin.idea.intentions import com.intellij.codeInspection.CleanupLocalInspectionTool -import com.intellij.codeInspection.ProblemHighlightType import com.intellij.openapi.editor.Editor import com.intellij.openapi.util.TextRange import org.jetbrains.kotlin.idea.KotlinBundle @@ -18,9 +17,7 @@ import org.jetbrains.kotlin.psi.psiUtil.getPrevSiblingIgnoringWhitespaceAndComme @Suppress("DEPRECATION") class RemoveEmptyParenthesesFromLambdaCallInspection : IntentionBasedInspection( RemoveEmptyParenthesesFromLambdaCallIntention::class -), CleanupLocalInspectionTool { - override fun problemHighlightType(element: KtValueArgumentList): ProblemHighlightType = ProblemHighlightType.LIKE_UNUSED_SYMBOL -} +), CleanupLocalInspectionTool class RemoveEmptyParenthesesFromLambdaCallIntention : SelfTargetingRangeIntention( KtValueArgumentList::class.java, KotlinBundle.lazyMessage("remove.unnecessary.parentheses.from.function.call.with.lambda") diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveEmptyPrimaryConstructorIntention.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveEmptyPrimaryConstructorIntention.kt index 7c5ed3199eb6..d62912bddab1 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveEmptyPrimaryConstructorIntention.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveEmptyPrimaryConstructorIntention.kt @@ -1,9 +1,8 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.kotlin.idea.intentions import com.intellij.codeInspection.CleanupLocalInspectionTool -import com.intellij.codeInspection.ProblemHighlightType import com.intellij.openapi.editor.Editor import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.inspections.IntentionBasedInspection @@ -14,9 +13,7 @@ import org.jetbrains.kotlin.psi.psiUtil.containingClass @Suppress("DEPRECATION") class RemoveEmptyPrimaryConstructorInspection : IntentionBasedInspection( RemoveEmptyPrimaryConstructorIntention::class -), CleanupLocalInspectionTool { - override fun problemHighlightType(element: KtPrimaryConstructor): ProblemHighlightType = ProblemHighlightType.LIKE_UNUSED_SYMBOL -} +), CleanupLocalInspectionTool class RemoveEmptyPrimaryConstructorIntention : SelfTargetingOffsetIndependentIntention( KtPrimaryConstructor::class.java, diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveEmptySecondaryConstructorBodyIntention.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveEmptySecondaryConstructorBodyIntention.kt index 66be92cf98c3..6c27cf4d5e98 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveEmptySecondaryConstructorBodyIntention.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveEmptySecondaryConstructorBodyIntention.kt @@ -1,9 +1,8 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.kotlin.idea.intentions import com.intellij.codeInspection.CleanupLocalInspectionTool -import com.intellij.codeInspection.ProblemHighlightType import com.intellij.openapi.editor.Editor import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.inspections.IntentionBasedInspection @@ -13,9 +12,7 @@ import org.jetbrains.kotlin.psi.KtSecondaryConstructor @Suppress("DEPRECATION") class RemoveEmptySecondaryConstructorBodyInspection : IntentionBasedInspection( RemoveEmptySecondaryConstructorBodyIntention::class -), CleanupLocalInspectionTool { - override fun problemHighlightType(element: KtBlockExpression): ProblemHighlightType = ProblemHighlightType.LIKE_UNUSED_SYMBOL -} +), CleanupLocalInspectionTool class RemoveEmptySecondaryConstructorBodyIntention : SelfTargetingOffsetIndependentIntention( KtBlockExpression::class.java, diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveExplicitSuperQualifierIntention.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveExplicitSuperQualifierIntention.kt index ac2b0cee9d2f..80e9021013a2 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveExplicitSuperQualifierIntention.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveExplicitSuperQualifierIntention.kt @@ -1,14 +1,13 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.kotlin.idea.intentions import com.intellij.codeInspection.CleanupLocalInspectionTool -import com.intellij.codeInspection.ProblemHighlightType import com.intellij.openapi.editor.Editor import com.intellij.openapi.util.TextRange import org.jetbrains.kotlin.idea.KotlinBundle -import org.jetbrains.kotlin.idea.caches.resolve.analyzeAsReplacement import org.jetbrains.kotlin.idea.caches.resolve.analyze +import org.jetbrains.kotlin.idea.caches.resolve.analyzeAsReplacement import org.jetbrains.kotlin.idea.inspections.IntentionBasedInspection import org.jetbrains.kotlin.psi.KtPsiFactory import org.jetbrains.kotlin.psi.KtQualifiedExpression @@ -24,9 +23,7 @@ import org.jetbrains.kotlin.types.error.ErrorUtils @Suppress("DEPRECATION") class RemoveExplicitSuperQualifierInspection : IntentionBasedInspection( RemoveExplicitSuperQualifierIntention::class -), CleanupLocalInspectionTool { - override fun problemHighlightType(element: KtSuperExpression): ProblemHighlightType = ProblemHighlightType.LIKE_UNUSED_SYMBOL -} +), CleanupLocalInspectionTool class RemoveExplicitSuperQualifierIntention : SelfTargetingRangeIntention( KtSuperExpression::class.java, diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveExplicitTypeArgumentsIntention.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveExplicitTypeArgumentsIntention.kt index e47e99375b60..bebffb41997d 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveExplicitTypeArgumentsIntention.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveExplicitTypeArgumentsIntention.kt @@ -5,7 +5,6 @@ package org.jetbrains.kotlin.idea.intentions import com.intellij.codeInspection.CleanupLocalInspectionTool import com.intellij.codeInspection.LocalQuickFix import com.intellij.codeInspection.ProblemDescriptor -import com.intellij.codeInspection.ProblemHighlightType import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project import com.intellij.openapi.util.Key @@ -37,7 +36,6 @@ import org.jetbrains.kotlin.types.checker.KotlinTypeChecker @Suppress("DEPRECATION") class RemoveExplicitTypeArgumentsInspection : IntentionBasedInspection(RemoveExplicitTypeArgumentsIntention::class), CleanupLocalInspectionTool { - override fun problemHighlightType(element: KtTypeArgumentList): ProblemHighlightType = ProblemHighlightType.LIKE_UNUSED_SYMBOL override fun additionalFixes(element: KtTypeArgumentList): List? { val declaration = element.getStrictParentOfType() ?: return null diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveForLoopIndicesIntention.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveForLoopIndicesIntention.kt index 2de4b4d4c779..14d613b724b6 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveForLoopIndicesIntention.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveForLoopIndicesIntention.kt @@ -3,7 +3,6 @@ package org.jetbrains.kotlin.idea.intentions import com.intellij.codeInspection.CleanupLocalInspectionTool -import com.intellij.codeInspection.ProblemHighlightType import com.intellij.openapi.editor.Editor import com.intellij.openapi.util.TextRange import com.intellij.psi.search.searches.ReferencesSearch @@ -21,9 +20,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe class RemoveForLoopIndicesInspection : IntentionBasedInspection( RemoveForLoopIndicesIntention::class, KotlinBundle.message("index.is.not.used.in.the.loop.body") -), CleanupLocalInspectionTool { - override fun problemHighlightType(element: KtForExpression): ProblemHighlightType = ProblemHighlightType.LIKE_UNUSED_SYMBOL -} +), CleanupLocalInspectionTool class RemoveForLoopIndicesIntention : SelfTargetingRangeIntention( KtForExpression::class.java, diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveRedundantCallsOfConversionMethodsIntention.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveRedundantCallsOfConversionMethodsIntention.kt index 912162988b02..9a4566b692e1 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveRedundantCallsOfConversionMethodsIntention.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/intentions/RemoveRedundantCallsOfConversionMethodsIntention.kt @@ -4,7 +4,6 @@ package org.jetbrains.kotlin.idea.intentions import com.intellij.codeInsight.intention.FileModifier.SafeFieldForPreview import com.intellij.codeInspection.CleanupLocalInspectionTool -import com.intellij.codeInspection.ProblemHighlightType import com.intellij.openapi.editor.Editor import com.intellij.openapi.util.TextRange import org.jetbrains.kotlin.idea.KotlinBundle @@ -22,9 +21,7 @@ import org.jetbrains.kotlin.types.isFlexible @Suppress("DEPRECATION") class RemoveRedundantCallsOfConversionMethodsInspection : IntentionBasedInspection( RemoveRedundantCallsOfConversionMethodsIntention::class -), CleanupLocalInspectionTool { - override fun problemHighlightType(element: KtQualifiedExpression) = ProblemHighlightType.LIKE_UNUSED_SYMBOL -} +), CleanupLocalInspectionTool class RemoveRedundantCallsOfConversionMethodsIntention : SelfTargetingRangeIntention( KtQualifiedExpression::class.java, diff --git a/plugins/kotlin/idea/tests/testData/codeInsight/outOfBlock/InnerClassInnerMethod.kt b/plugins/kotlin/idea/tests/testData/codeInsight/outOfBlock/InnerClassInnerMethod.kt index d104b289e141..eea713b6ed99 100644 --- a/plugins/kotlin/idea/tests/testData/codeInsight/outOfBlock/InnerClassInnerMethod.kt +++ b/plugins/kotlin/idea/tests/testData/codeInsight/outOfBlock/InnerClassInnerMethod.kt @@ -1,7 +1,7 @@ // OUT_OF_CODE_BLOCK: FALSE // TYPE: '\b"a"' // INSPECTION-CLASS: org.jetbrains.kotlin.idea.inspections.RedundantInnerClassModifierInspection -// INSPECTION: [LIKE_UNUSED_SYMBOL:6] Redundant 'inner' modifier +// INSPECTION: [GENERIC_ERROR_OR_WARNING:6] Redundant 'inner' modifier class RedundantInner(private val s: String) { private inner class D { fun f(): Int { diff --git a/plugins/kotlin/plugin/resources/META-INF/inspections-fe10.xml b/plugins/kotlin/plugin/resources/META-INF/inspections-fe10.xml index 5e359fdf95d7..a5e9e8fe7008 100644 --- a/plugins/kotlin/plugin/resources/META-INF/inspections-fe10.xml +++ b/plugins/kotlin/plugin/resources/META-INF/inspections-fe10.xml @@ -1194,7 +1194,7 @@ enabledByDefault="true" cleanupTool="true" level="WEAK WARNING" - language="kotlin" + language="kotlin" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES" key="inspection.remove.explicit.type.arguments.display.name" bundle="messages.KotlinBundle"/> @@ -2156,7 +2156,7 @@ enabledByDefault="true" level="WARNING" language="kotlin" - cleanupTool="true" + cleanupTool="true" editorAttributes="NOT_USED_ELEMENT_ATTRIBUTES" key="inspection.redundant.unit.expression.display.name" bundle="messages.KotlinBundle"/>