[devKit] IJ-CR-102194 LightServiceMustBeFinal: highlight the problem as an error

IDEA-236032

GitOrigin-RevId: 869ef0fe709630c7c6ebe6db04ea370dd415edc8
This commit is contained in:
Andrey Cherkasov
2023-02-22 17:57:05 +00:00
committed by intellij-monorepo-bot
parent d2c2353529
commit 8b09356f76
3 changed files with 4 additions and 3 deletions
@@ -2,6 +2,7 @@
package org.jetbrains.idea.devkit.inspections
import com.intellij.codeInspection.IntentionWrapper
import com.intellij.codeInspection.ProblemHighlightType
import com.intellij.lang.jvm.DefaultJvmElementVisitor
import com.intellij.lang.jvm.JvmClass
import com.intellij.lang.jvm.JvmElementVisitor
@@ -22,7 +23,7 @@ internal class LightServiceMustBeFinalInspection : DevKitJvmInspection() {
if (hasServiceAnnotation && !clazz.hasModifier(JvmModifier.FINAL)) {
val actions = createModifierActions(clazz, modifierRequest(JvmModifier.FINAL, true))
val fixes = IntentionWrapper.wrapToQuickFixes(actions.toTypedArray(), file)
sink.highlight(DevKitBundle.message("inspection.light.service.must.be.final.message"), *fixes)
sink.highlight(DevKitBundle.message("inspection.light.service.must.be.final.message"), ProblemHighlightType.GENERIC_ERROR, *fixes)
}
return true
}
@@ -1,5 +1,5 @@
import com.intellij.openapi.components.Service;
@Service
class <warning descr="Light service must be final">MyService<caret></warning> {
class <error descr="Light service must be final">MyService<caret></error> {
}
@@ -1,4 +1,4 @@
import com.intellij.openapi.components.Service
@Service
open class <warning descr="Light service must be final">MyService<caret></warning>
open class <error descr="Light service must be final">MyService<caret></error>