From d96d53225d5ac3c627b9970a3819c548cf7a3ef2 Mon Sep 17 00:00:00 2001 From: Andrey Cherkasov Date: Thu, 17 Oct 2024 23:05:35 +0400 Subject: [PATCH] [kotlin] Port `RestrictedRetentionForExpressionAnnotationFactory` for K2 ^KTIJ-29620 Fixed GitOrigin-RevId: d7ce975589f14735897a5d5a2a15a4ed5ee8361f --- .../fixes/KotlinK2QuickFixRegistrar.kt | 1 + ...tentionForExpressionAnnotationFactories.kt | 38 ++++++ .../fixes/HighLevelQuickFixTestGenerated.java | 124 ++++++++++++++++++ .../addSourceRetention/noRetention.kt | 3 +- .../addSourceRetention/noRetention.kt.after | 3 +- .../addSourceRetention/noRetention2.kt | 3 +- .../addSourceRetention/noRetention2.kt.after | 3 +- .../binaryRetention.kt | 3 +- .../binaryRetention.kt.after | 3 +- .../changeRetentionToSource/emptyRetention.kt | 3 +- .../emptyRetention.kt.after | 3 +- .../emptyRetention2.kt | 3 +- .../emptyRetention2.kt.after | 3 +- .../emptyRetention3.kt | 3 +- .../emptyRetention3.kt.after | 3 +- .../removeExpressionTarget/binaryRetention.kt | 3 +- .../binaryRetention.kt.after | 3 +- .../removeExpressionTarget/emptyRetention.kt | 3 +- .../emptyRetention.kt.after | 3 +- .../removeExpressionTarget/emptyRetention2.kt | 3 +- .../emptyRetention2.kt.after | 3 +- .../removeExpressionTarget/multipleTargets.kt | 3 +- .../multipleTargets.kt.after | 3 +- .../multipleTargetsImported.kt | 3 +- .../multipleTargetsImported.kt.after | 3 +- .../removeExpressionTarget/noRetention.kt | 3 +- .../noRetention.kt.after | 3 +- .../codeinsight/GenerateK2QuickFixTests.kt | 2 +- 28 files changed, 212 insertions(+), 25 deletions(-) create mode 100644 plugins/kotlin/code-insight/fixes-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/RestrictedRetentionForExpressionAnnotationFactories.kt diff --git a/plugins/kotlin/code-insight/fixes-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/KotlinK2QuickFixRegistrar.kt b/plugins/kotlin/code-insight/fixes-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/KotlinK2QuickFixRegistrar.kt index d1ffefd60f35..423b8de58f13 100644 --- a/plugins/kotlin/code-insight/fixes-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/KotlinK2QuickFixRegistrar.kt +++ b/plugins/kotlin/code-insight/fixes-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/KotlinK2QuickFixRegistrar.kt @@ -187,6 +187,7 @@ class KotlinK2QuickFixRegistrar : KotlinQuickFixRegistrar() { registerFactory(SurroundWithLambdaForTypeMismatchFixFactory.assignmentTypeMismatchFixFactory) registerFactory(SurroundWithLambdaForTypeMismatchFixFactory.initializerTypeMismatchFixFactory) registerFactory(SurroundWithLambdaForTypeMismatchFixFactory.returnTypeMismatchFixFactory) + registerFactory(RestrictedRetentionForExpressionAnnotationFactories.quickFixFactory) } private val addAbstract = KtQuickFixesListBuilder.registerPsiQuickFix { diff --git a/plugins/kotlin/code-insight/fixes-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/RestrictedRetentionForExpressionAnnotationFactories.kt b/plugins/kotlin/code-insight/fixes-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/RestrictedRetentionForExpressionAnnotationFactories.kt new file mode 100644 index 000000000000..abeff1c949d9 --- /dev/null +++ b/plugins/kotlin/code-insight/fixes-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/RestrictedRetentionForExpressionAnnotationFactories.kt @@ -0,0 +1,38 @@ +// Copyright 2000-2024 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.KaSession +import org.jetbrains.kotlin.analysis.api.fir.diagnostics.KaFirDiagnostic +import org.jetbrains.kotlin.builtins.StandardNames +import org.jetbrains.kotlin.idea.codeinsight.api.applicators.fixes.KotlinQuickFixFactory +import org.jetbrains.kotlin.idea.quickfix.AddSourceRetentionFix +import org.jetbrains.kotlin.idea.quickfix.ChangeRetentionToSourceFix +import org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix +import org.jetbrains.kotlin.idea.quickfix.findExpressionTargetArgument +import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.psi.KtAnnotationEntry +import org.jetbrains.kotlin.psi.KtClass +import org.jetbrains.kotlin.psi.psiUtil.containingClass + +internal object RestrictedRetentionForExpressionAnnotationFactories { + + val quickFixFactory = KotlinQuickFixFactory.ModCommandBased { diagnostic: KaFirDiagnostic.RestrictedRetentionForExpressionAnnotationError -> + val annotationEntry = diagnostic.psi as? KtAnnotationEntry ?: return@ModCommandBased emptyList() + val containingClass = annotationEntry.containingClass() ?: return@ModCommandBased emptyList() + val retentionAnnotation = findAnnotation(containingClass, StandardNames.FqNames.retention) + val targetAnnotation = findAnnotation(containingClass, StandardNames.FqNames.target) + val expressionTargetArgument = if (targetAnnotation != null) findExpressionTargetArgument(targetAnnotation) else null + + listOfNotNull( + if (expressionTargetArgument != null) RemoveExpressionTargetFix(expressionTargetArgument) else null, + if (retentionAnnotation == null) AddSourceRetentionFix(containingClass) else ChangeRetentionToSourceFix(retentionAnnotation) + ) + } + + private fun KaSession.findAnnotation(ktClass: KtClass, fqName: FqName): KtAnnotationEntry? { + return ktClass.annotationEntries.firstOrNull { + it.typeReference?.text?.endsWith(fqName.shortName().asString()) == true + && it.typeReference?.type?.expandedSymbol?.importableFqName == fqName + } + } +} diff --git a/plugins/kotlin/code-insight/fixes-k2/tests/test/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/HighLevelQuickFixTestGenerated.java b/plugins/kotlin/code-insight/fixes-k2/tests/test/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/HighLevelQuickFixTestGenerated.java index b1fb2036df6d..b255cb236430 100644 --- a/plugins/kotlin/code-insight/fixes-k2/tests/test/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/HighLevelQuickFixTestGenerated.java +++ b/plugins/kotlin/code-insight/fixes-k2/tests/test/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/HighLevelQuickFixTestGenerated.java @@ -11233,7 +11233,131 @@ public abstract class HighLevelQuickFixTestGenerated extends AbstractHighLevelQu } } + @RunWith(JUnit3RunnerWithInners.class) + @TestMetadata("../../../idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation") + public abstract static class RestrictedRetentionForExpressionAnnotation extends AbstractHighLevelQuickFixTest { + @RunWith(JUnit3RunnerWithInners.class) + @TestMetadata("../../../idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/addSourceRetention") + public static class AddSourceRetention extends AbstractHighLevelQuickFixTest { + @java.lang.Override + @org.jetbrains.annotations.NotNull + public final KotlinPluginMode getPluginMode() { + return KotlinPluginMode.K2; + } + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("binaryRetention.kt") + public void testBinaryRetention() throws Exception { + runTest("../../../idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/addSourceRetention/binaryRetention.kt"); + } + + @TestMetadata("emptyRetention.kt") + public void testEmptyRetention() throws Exception { + runTest("../../../idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/addSourceRetention/emptyRetention.kt"); + } + + @TestMetadata("emptyRetention2.kt") + public void testEmptyRetention2() throws Exception { + runTest("../../../idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/addSourceRetention/emptyRetention2.kt"); + } + + @TestMetadata("noRetention.kt") + public void testNoRetention() throws Exception { + runTest("../../../idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/addSourceRetention/noRetention.kt"); + } + + @TestMetadata("noRetention2.kt") + public void testNoRetention2() throws Exception { + runTest("../../../idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/addSourceRetention/noRetention2.kt"); + } + } + + @RunWith(JUnit3RunnerWithInners.class) + @TestMetadata("../../../idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource") + public static class ChangeRetentionToSource extends AbstractHighLevelQuickFixTest { + @java.lang.Override + @org.jetbrains.annotations.NotNull + public final KotlinPluginMode getPluginMode() { + return KotlinPluginMode.K2; + } + + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("binaryRetention.kt") + public void testBinaryRetention() throws Exception { + runTest("../../../idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/binaryRetention.kt"); + } + + @TestMetadata("emptyRetention.kt") + public void testEmptyRetention() throws Exception { + runTest("../../../idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention.kt"); + } + + @TestMetadata("emptyRetention2.kt") + public void testEmptyRetention2() throws Exception { + runTest("../../../idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention2.kt"); + } + + @TestMetadata("emptyRetention3.kt") + public void testEmptyRetention3() throws Exception { + runTest("../../../idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention3.kt"); + } + + @TestMetadata("noRetention.kt") + public void testNoRetention() throws Exception { + runTest("../../../idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/noRetention.kt"); + } + } + + @RunWith(JUnit3RunnerWithInners.class) + @TestMetadata("../../../idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget") + public static class RemoveExpressionTarget extends AbstractHighLevelQuickFixTest { + @java.lang.Override + @org.jetbrains.annotations.NotNull + public final KotlinPluginMode getPluginMode() { + return KotlinPluginMode.K2; + } + + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("binaryRetention.kt") + public void testBinaryRetention() throws Exception { + runTest("../../../idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/binaryRetention.kt"); + } + + @TestMetadata("emptyRetention.kt") + public void testEmptyRetention() throws Exception { + runTest("../../../idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/emptyRetention.kt"); + } + + @TestMetadata("emptyRetention2.kt") + public void testEmptyRetention2() throws Exception { + runTest("../../../idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/emptyRetention2.kt"); + } + + @TestMetadata("multipleTargets.kt") + public void testMultipleTargets() throws Exception { + runTest("../../../idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/multipleTargets.kt"); + } + + @TestMetadata("multipleTargetsImported.kt") + public void testMultipleTargetsImported() throws Exception { + runTest("../../../idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/multipleTargetsImported.kt"); + } + + @TestMetadata("noRetention.kt") + public void testNoRetention() throws Exception { + runTest("../../../idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/noRetention.kt"); + } + } + } @RunWith(JUnit3RunnerWithInners.class) @TestMetadata("../../../idea/tests/testData/quickfix/simplifyComparison") diff --git a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/addSourceRetention/noRetention.kt b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/addSourceRetention/noRetention.kt index 0353f2c61291..dd6936bfc8ad 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/addSourceRetention/noRetention.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/addSourceRetention/noRetention.kt @@ -1,4 +1,5 @@ // "Add SOURCE retention" "true" @Target(AnnotationTarget.EXPRESSION) annotation class Ann -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddSourceRetentionFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddSourceRetentionFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddSourceRetentionFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/addSourceRetention/noRetention.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/addSourceRetention/noRetention.kt.after index 3c061ff8f81f..ea4f101dd3e9 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/addSourceRetention/noRetention.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/addSourceRetention/noRetention.kt.after @@ -2,4 +2,5 @@ @Retention(AnnotationRetention.SOURCE) @Target(AnnotationTarget.EXPRESSION) annotation class Ann -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddSourceRetentionFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddSourceRetentionFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddSourceRetentionFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/addSourceRetention/noRetention2.kt b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/addSourceRetention/noRetention2.kt index eb1be8551e89..7d21bbac0950 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/addSourceRetention/noRetention2.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/addSourceRetention/noRetention2.kt @@ -4,4 +4,5 @@ annotation class Retention @Retention @Target(AnnotationTarget.EXPRESSION) annotation class Ann -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddSourceRetentionFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddSourceRetentionFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddSourceRetentionFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/addSourceRetention/noRetention2.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/addSourceRetention/noRetention2.kt.after index 31e2cbfc29e9..3a0b6fb7832c 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/addSourceRetention/noRetention2.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/addSourceRetention/noRetention2.kt.after @@ -5,4 +5,5 @@ annotation class Retention @Retention @Target(AnnotationTarget.EXPRESSION) annotation class Ann -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddSourceRetentionFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddSourceRetentionFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.AddSourceRetentionFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/binaryRetention.kt b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/binaryRetention.kt index 02e1039848d9..a348b528ef25 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/binaryRetention.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/binaryRetention.kt @@ -2,4 +2,5 @@ @Retention(AnnotationRetention.BINARY) @Target(AnnotationTarget.EXPRESSION) annotation class Ann -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeRetentionToSourceFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeRetentionToSourceFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeRetentionToSourceFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/binaryRetention.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/binaryRetention.kt.after index 758c641d47a4..3221099b2eb7 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/binaryRetention.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/binaryRetention.kt.after @@ -2,4 +2,5 @@ @Retention(AnnotationRetention.SOURCE) @Target(AnnotationTarget.EXPRESSION) annotation class Ann -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeRetentionToSourceFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeRetentionToSourceFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeRetentionToSourceFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention.kt b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention.kt index ded37b8d8196..a7dc2cbcc592 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention.kt @@ -2,4 +2,5 @@ @Retention @Target(AnnotationTarget.EXPRESSION) annotation class Ann -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeRetentionToSourceFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeRetentionToSourceFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeRetentionToSourceFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention.kt.after index 758c641d47a4..3221099b2eb7 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention.kt.after @@ -2,4 +2,5 @@ @Retention(AnnotationRetention.SOURCE) @Target(AnnotationTarget.EXPRESSION) annotation class Ann -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeRetentionToSourceFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeRetentionToSourceFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeRetentionToSourceFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention2.kt b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention2.kt index eb57cf37bd21..80038f2b6579 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention2.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention2.kt @@ -2,4 +2,5 @@ @Retention() @Target(AnnotationTarget.EXPRESSION) annotation class Ann -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeRetentionToSourceFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeRetentionToSourceFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeRetentionToSourceFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention2.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention2.kt.after index 758c641d47a4..3221099b2eb7 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention2.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention2.kt.after @@ -2,4 +2,5 @@ @Retention(AnnotationRetention.SOURCE) @Target(AnnotationTarget.EXPRESSION) annotation class Ann -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeRetentionToSourceFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeRetentionToSourceFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeRetentionToSourceFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention3.kt b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention3.kt index 6c9a209d99fd..8e8acf9e30f1 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention3.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention3.kt @@ -4,4 +4,5 @@ class AnnotationRetention @Retention() @Target(AnnotationTarget.EXPRESSION) annotation class Ann -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeRetentionToSourceFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeRetentionToSourceFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeRetentionToSourceFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention3.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention3.kt.after index 344b187259f1..7a15a5239acd 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention3.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/changeRetentionToSource/emptyRetention3.kt.after @@ -6,4 +6,5 @@ class AnnotationRetention @Retention(AnnotationRetention.SOURCE) @Target(AnnotationTarget.EXPRESSION) annotation class Ann -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeRetentionToSourceFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeRetentionToSourceFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeRetentionToSourceFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/binaryRetention.kt b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/binaryRetention.kt index 4182742beb5b..0215e5e8ff41 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/binaryRetention.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/binaryRetention.kt @@ -2,4 +2,5 @@ @Retention(AnnotationRetention.BINARY) @Target(AnnotationTarget.EXPRESSION) annotation class Ann -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/binaryRetention.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/binaryRetention.kt.after index a8d08d49619c..7a8ad21b94d7 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/binaryRetention.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/binaryRetention.kt.after @@ -1,4 +1,5 @@ // "Remove EXPRESSION target" "true" @Retention(AnnotationRetention.BINARY) annotation class Ann -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/emptyRetention.kt b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/emptyRetention.kt index 9035637db18d..60fa3a837dba 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/emptyRetention.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/emptyRetention.kt @@ -2,4 +2,5 @@ @Retention @Target(AnnotationTarget.EXPRESSION) annotation class Ann -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/emptyRetention.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/emptyRetention.kt.after index 86825bc469b5..d93fd74f4d00 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/emptyRetention.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/emptyRetention.kt.after @@ -1,4 +1,5 @@ // "Remove EXPRESSION target" "true" @Retention annotation class Ann -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/emptyRetention2.kt b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/emptyRetention2.kt index d2043f52d589..a0162dd6ab01 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/emptyRetention2.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/emptyRetention2.kt @@ -2,4 +2,5 @@ @Retention() @Target(AnnotationTarget.EXPRESSION) annotation class Ann -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/emptyRetention2.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/emptyRetention2.kt.after index 2cfc7ea3c4e7..8931368cb6f5 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/emptyRetention2.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/emptyRetention2.kt.after @@ -1,4 +1,5 @@ // "Remove EXPRESSION target" "true" @Retention() annotation class Ann -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/multipleTargets.kt b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/multipleTargets.kt index 749ae0c9ee8e..db82e00d43e0 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/multipleTargets.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/multipleTargets.kt @@ -4,4 +4,5 @@ import kotlin.annotation.AnnotationTarget.* @Retention @Target(FIELD, EXPRESSION, PROPERTY) annotation class Ann -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/multipleTargets.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/multipleTargets.kt.after index 3c63e0e3752c..b3f4f505e826 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/multipleTargets.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/multipleTargets.kt.after @@ -4,4 +4,5 @@ import kotlin.annotation.AnnotationTarget.* @Retention @Target(FIELD, PROPERTY) annotation class Ann -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/multipleTargetsImported.kt b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/multipleTargetsImported.kt index d76775697c4e..a39723f16bfc 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/multipleTargetsImported.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/multipleTargetsImported.kt @@ -2,4 +2,5 @@ @Retention @Target(AnnotationTarget.FIELD, AnnotationTarget.EXPRESSION, AnnotationTarget.PROPERTY) annotation class Ann -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/multipleTargetsImported.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/multipleTargetsImported.kt.after index 30ae8229087d..b97ba0010f5b 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/multipleTargetsImported.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/multipleTargetsImported.kt.after @@ -2,4 +2,5 @@ @Retention @Target(AnnotationTarget.FIELD, AnnotationTarget.PROPERTY) annotation class Ann -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/noRetention.kt b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/noRetention.kt index 51c164986c7b..68f093c21b8e 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/noRetention.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/noRetention.kt @@ -1,4 +1,5 @@ // "Remove EXPRESSION target" "true" @Target(AnnotationTarget.EXPRESSION) annotation class Ann -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/noRetention.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/noRetention.kt.after index 6d0aa6c3eecc..0e8a9eedf899 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/noRetention.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/restrictedRetentionForExpressionAnnotation/removeExpressionTarget/noRetention.kt.after @@ -1,3 +1,4 @@ // "Remove EXPRESSION target" "true" annotation class Ann -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemoveExpressionTargetFix \ No newline at end of file diff --git a/plugins/kotlin/util/test-generator-fir/test/org/jetbrains/kotlin/fir/testGenerator/codeinsight/GenerateK2QuickFixTests.kt b/plugins/kotlin/util/test-generator-fir/test/org/jetbrains/kotlin/fir/testGenerator/codeinsight/GenerateK2QuickFixTests.kt index c64d282bfa07..c243b98264a7 100644 --- a/plugins/kotlin/util/test-generator-fir/test/org/jetbrains/kotlin/fir/testGenerator/codeinsight/GenerateK2QuickFixTests.kt +++ b/plugins/kotlin/util/test-generator-fir/test/org/jetbrains/kotlin/fir/testGenerator/codeinsight/GenerateK2QuickFixTests.kt @@ -186,7 +186,7 @@ internal fun MutableTWorkspace.generateK2FixTests() { model("$idea/quickfix/renameUnresolvedReference", pattern = pattern, isIgnored = true) model("$idea/quickfix/reorderParameters", pattern = pattern) model("$idea/quickfix/replaceJvmFieldWithConst", pattern = pattern) - model("$idea/quickfix/restrictedRetentionForExpressionAnnotation", pattern = pattern, isIgnored = true) + model("$idea/quickfix/restrictedRetentionForExpressionAnnotation", pattern = pattern) model("$idea/quickfix/simplifyComparison", pattern = pattern) model("$idea/quickfix/smartCastImpossibleInIfThen", pattern = pattern) model("$idea/quickfix/specifyOverrideExplicitly", pattern = pattern)