mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[kotlin] Provide quick fix to remove @JvmField for INAPPLICABLE_JVM_FIELD
#KTIJ-33906 Fixed GitOrigin-RevId: 717da16ba3904fba7a5fe370f7cb99714a12ddfc
This commit is contained in:
committed by
intellij-monorepo-bot
parent
71ebfc4c2f
commit
429b92ac01
+16
@@ -0,0 +1,16 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.idea.k2.codeinsight.fixes
|
||||
|
||||
import org.jetbrains.kotlin.analysis.api.fir.diagnostics.KaFirDiagnostic
|
||||
import org.jetbrains.kotlin.idea.base.resources.KotlinBundle
|
||||
import org.jetbrains.kotlin.idea.codeinsight.api.applicators.fixes.KotlinQuickFixFactory
|
||||
import org.jetbrains.kotlin.idea.inspections.RemoveAnnotationFix
|
||||
|
||||
internal object InapplicableJvmFieldFixFactories {
|
||||
|
||||
val removeAnnotationFixFactory = KotlinQuickFixFactory.IntentionBased { diagnostic: KaFirDiagnostic.InapplicableJvmField ->
|
||||
listOf(
|
||||
RemoveAnnotationFix(KotlinBundle.message("remove.jvmfield.annotation"), diagnostic.psi)
|
||||
)
|
||||
}
|
||||
}
|
||||
+1
@@ -188,6 +188,7 @@ class KotlinK2QuickFixRegistrar : KotlinQuickFixRegistrar() {
|
||||
registerFactory(JavaClassOnCompanionFixFactories.factory)
|
||||
registerFactory(ChangeTypeQuickFixFactories.implicitNothingReturnTypeFixFactory)
|
||||
registerFactory(ChangeTypeQuickFixFactories.implicitNothingPropertyTypeFixFactory)
|
||||
registerFactory(InapplicableJvmFieldFixFactories.removeAnnotationFixFactory)
|
||||
}
|
||||
|
||||
private val addAbstract = KtQuickFixesListBuilder.registerPsiQuickFix {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// "Remove @JvmField annotation" "true"
|
||||
// IGNORE_K2
|
||||
// WITH_STDLIB
|
||||
class Foo {
|
||||
<caret>@JvmField private val bar = 0
|
||||
}
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.RemoveAnnotationFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.RemoveAnnotationFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.RemoveAnnotationFix
|
||||
@@ -1,7 +1,7 @@
|
||||
// "Remove @JvmField annotation" "true"
|
||||
// IGNORE_K2
|
||||
// WITH_STDLIB
|
||||
class Foo {
|
||||
private val bar = 0
|
||||
}
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.RemoveAnnotationFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.RemoveAnnotationFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.RemoveAnnotationFix
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
// "Remove @JvmField annotation" "true"
|
||||
// IGNORE_K2
|
||||
// WITH_STDLIB
|
||||
interface I {
|
||||
val x: Int
|
||||
}
|
||||
|
||||
class C1 : I { <caret>@JvmField override val x: Int = 1 }
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.RemoveAnnotationFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.RemoveAnnotationFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.RemoveAnnotationFix
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
// "Remove @JvmField annotation" "true"
|
||||
// IGNORE_K2
|
||||
// WITH_STDLIB
|
||||
interface I {
|
||||
val x: Int
|
||||
}
|
||||
|
||||
class C1 : I { override val x: Int = 1 }
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.RemoveAnnotationFix
|
||||
// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.RemoveAnnotationFix
|
||||
// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.RemoveAnnotationFix
|
||||
Reference in New Issue
Block a user