From 2125c42328a350221062c74fb7065f81ac92982b Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 27 Mar 2018 16:53:20 +0300 Subject: [PATCH] Make DeprecatedCallableAddReplaceWithInspection applicability based Removes intention version of the same thing Includes some optimization of 'Deprecated' annotation detection --- .../after.kt.template | 4 - .../before.kt.template | 4 - .../description.html | 5 - idea/src/META-INF/plugin.xml | 7 +- ...ecatedCallableAddReplaceWithInspection.kt} | 87 +++++----- .../.inspection | 1 + .../AlreadyWithReplaceWith.kt | 2 +- .../CommentInBody.kt | 0 .../CommentInBody.kt.after | 0 .../DeclarationInside.kt | 2 +- .../DeprecationLevelHidden.kt | 2 +- .../ExceptionInPropertyDestructuringEntry.kt | 2 +- .../ExpressionBody.kt | 0 .../ExpressionBody.kt.after | 0 .../deprecatedCallableAddReplaceWith/If.kt | 0 .../If.kt.after | 0 .../Imports.1.kt | 0 .../Imports.1.kt.after | 0 .../Imports.kt | 0 .../Imports.kt.after | 0 .../NoCompanionObjectImport.1.kt | 0 .../NoCompanionObjectImport.1.kt.after | 0 .../NoCompanionObjectImport.kt | 0 .../NoCompanionObjectImport.kt.after | 0 .../NoDefaultImport.kt | 0 .../NoDefaultImport.kt.after | 0 .../NoReturn.kt | 2 +- .../NotAvailableOnDocComment.kt | 2 +- .../PrivateSymbolUsed.kt | 2 +- .../QualifiedCall.kt | 0 .../QualifiedCall.kt.after | 0 .../Return.kt | 0 .../Return.kt.after | 0 .../ReturnInside.kt | 2 +- .../Simple.kt | 0 .../Simple.kt.after | 0 .../StringLiteral.kt | 0 .../StringLiteral.kt.after | 0 .../StringTemplate.kt | 0 .../StringTemplate.kt.after | 0 .../TwoStatements.kt | 2 +- .../ValProperty.kt | 0 .../ValProperty.kt.after | 0 .../ValPropertyWithReturn.kt | 0 .../ValPropertyWithReturn.kt.after | 0 .../destructuringWithLambdaInScript.kts | 2 +- .../inspectionData/expected.xml | 56 +++---- .../inspectionData/inspections.test | 1 + .../justLambdaInScript.kts | 2 +- .../.intention | 1 - .../inspectionData/inspections.test | 1 - .../codeInsight/InspectionTestGenerated.java | 12 +- .../LocalInspectionTestGenerated.java | 153 ++++++++++++++++++ .../intentions/IntentionTestGenerated.java | 153 ------------------ 54 files changed, 245 insertions(+), 262 deletions(-) delete mode 100644 idea/resources/intentionDescriptions/DeprecatedCallableAddReplaceWithIntention/after.kt.template delete mode 100644 idea/resources/intentionDescriptions/DeprecatedCallableAddReplaceWithIntention/before.kt.template delete mode 100644 idea/resources/intentionDescriptions/DeprecatedCallableAddReplaceWithIntention/description.html rename idea/src/org/jetbrains/kotlin/idea/{intentions/DeprecatedCallableAddReplaceWithIntention.kt => inspections/DeprecatedCallableAddReplaceWithInspection.kt} (75%) create mode 100644 idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/.inspection rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/AlreadyWithReplaceWith.kt (77%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/CommentInBody.kt (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/CommentInBody.kt.after (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/DeclarationInside.kt (81%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/DeprecationLevelHidden.kt (85%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/ExceptionInPropertyDestructuringEntry.kt (75%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/ExpressionBody.kt (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/ExpressionBody.kt.after (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/If.kt (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/If.kt.after (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/Imports.1.kt (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/Imports.1.kt.after (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/Imports.kt (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/Imports.kt.after (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/NoCompanionObjectImport.1.kt (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/NoCompanionObjectImport.1.kt.after (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/NoCompanionObjectImport.kt (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/NoCompanionObjectImport.kt.after (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/NoDefaultImport.kt (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/NoDefaultImport.kt.after (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/NoReturn.kt (87%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/NotAvailableOnDocComment.kt (79%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/PrivateSymbolUsed.kt (83%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/QualifiedCall.kt (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/QualifiedCall.kt.after (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/Return.kt (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/Return.kt.after (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/ReturnInside.kt (77%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/Simple.kt (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/Simple.kt.after (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/StringLiteral.kt (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/StringLiteral.kt.after (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/StringTemplate.kt (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/StringTemplate.kt.after (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/TwoStatements.kt (74%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/ValProperty.kt (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/ValProperty.kt.after (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/ValPropertyWithReturn.kt (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/ValPropertyWithReturn.kt.after (100%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/destructuringWithLambdaInScript.kts (83%) rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/inspectionData/expected.xml (60%) create mode 100644 idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/inspectionData/inspections.test rename idea/testData/{intentions => inspectionsLocal}/deprecatedCallableAddReplaceWith/justLambdaInScript.kts (81%) delete mode 100644 idea/testData/intentions/deprecatedCallableAddReplaceWith/.intention delete mode 100644 idea/testData/intentions/deprecatedCallableAddReplaceWith/inspectionData/inspections.test diff --git a/idea/resources/intentionDescriptions/DeprecatedCallableAddReplaceWithIntention/after.kt.template b/idea/resources/intentionDescriptions/DeprecatedCallableAddReplaceWithIntention/after.kt.template deleted file mode 100644 index a8701323b86..00000000000 --- a/idea/resources/intentionDescriptions/DeprecatedCallableAddReplaceWithIntention/after.kt.template +++ /dev/null @@ -1,4 +0,0 @@ -@deprecated("Use newFun instead", ReplaceWith("newFun(null)")) -fun oldFun(): Int { - return newFun(null) -} \ No newline at end of file diff --git a/idea/resources/intentionDescriptions/DeprecatedCallableAddReplaceWithIntention/before.kt.template b/idea/resources/intentionDescriptions/DeprecatedCallableAddReplaceWithIntention/before.kt.template deleted file mode 100644 index d5928013986..00000000000 --- a/idea/resources/intentionDescriptions/DeprecatedCallableAddReplaceWithIntention/before.kt.template +++ /dev/null @@ -1,4 +0,0 @@ -@deprecated("Use newFun instead") -fun oldFun(): Int { - return newFun(null) -} \ No newline at end of file diff --git a/idea/resources/intentionDescriptions/DeprecatedCallableAddReplaceWithIntention/description.html b/idea/resources/intentionDescriptions/DeprecatedCallableAddReplaceWithIntention/description.html deleted file mode 100644 index 19846598e5d..00000000000 --- a/idea/resources/intentionDescriptions/DeprecatedCallableAddReplaceWithIntention/description.html +++ /dev/null @@ -1,5 +0,0 @@ - - -This intention adds a kotlin.ReplaceWith argument to a kotlin.deprecated annotation on a function or a property based on its body. - - \ No newline at end of file diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index 2e7d50bef07..7ec629bff6a 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -1203,11 +1203,6 @@ Kotlin - - org.jetbrains.kotlin.idea.intentions.DeprecatedCallableAddReplaceWithIntention - Kotlin - - org.jetbrains.kotlin.idea.intentions.AddNameToArgumentIntention Kotlin @@ -1605,7 +1600,7 @@ language="kotlin" /> - (DeprecatedCallableAddReplaceWithIntention::class) - -class DeprecatedCallableAddReplaceWithIntention : SelfTargetingRangeIntention( - KtCallableDeclaration::class.java, "Add 'replaceWith' argument to specify replacement pattern", "Add 'replaceWith' argument to 'Deprecated' annotation" +class DeprecatedCallableAddReplaceWithInspection : AbstractApplicabilityBasedInspection( + KtCallableDeclaration::class.java ) { + override fun inspectionText(element: KtCallableDeclaration) = + "@Deprecated annotation without 'replaceWith' argument" + + override fun inspectionTarget(element: KtCallableDeclaration): KtAnnotationEntry = + element.annotationEntries.first { it.shortName == DEPRECATED_NAME } + + override val defaultFixText = + "Add 'replaceWith' argument to specify replacement pattern" + private class ReplaceWith(val expression: String, vararg val imports: String) - override fun applicabilityRange(element: KtCallableDeclaration): TextRange? { - val annotationEntry = element.deprecatedAnnotationWithNoReplaceWith() ?: return null - if (element.suggestReplaceWith() == null) return null - return annotationEntry.textRange + override fun isApplicable(element: KtCallableDeclaration): Boolean { + element.deprecatedAnnotationWithNoReplaceWith() ?: return false + return element.suggestReplaceWith() != null } - override fun applyTo(element: KtCallableDeclaration, editor: Editor?) { - val replaceWith = element.suggestReplaceWith()!! + override fun applyTo(element: PsiElement, project: Project, editor: Editor?) { + val declaration = element.getParentOfType(strict = true) ?: return + val replaceWith = declaration.suggestReplaceWith()!! assert('\n' !in replaceWith.expression && '\r' !in replaceWith.expression) { "Formatted expression text should not contain \\n or \\r" } - val annotationEntry = element.deprecatedAnnotationWithNoReplaceWith()!! - val psiFactory = KtPsiFactory(element) + val annotationEntry = declaration.deprecatedAnnotationWithNoReplaceWith()!! + val psiFactory = KtPsiFactory(declaration) - var escapedText = replaceWith.expression - .replace("\\", "\\\\") - .replace("\"", "\\\"") + var escapedText = replaceWith.expression.replace("\\", "\\\\").replace("\"", "\\\"") // escape '$' if it's followed by a letter or '{' if (escapedText.contains('$')) { @@ -108,15 +103,12 @@ class DeprecatedCallableAddReplaceWithIntention : SelfTargetingRangeIntention() - expression.accept(object : KtVisitorVoid(){ + expression.accept(object : KtVisitorVoid() { override fun visitSimpleNameExpression(expression: KtSimpleNameExpression) { val bindingContext = expression.analyze() val target = bindingContext[BindingContext.SHORT_REFERENCE_TO_COMPANION_OBJECT, expression] @@ -221,7 +217,8 @@ class DeprecatedCallableAddReplaceWithIntention : SelfTargetingRangeIntention@Deprecated("", ReplaceWith("bar()")) fun foo() { bar() diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/CommentInBody.kt b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/CommentInBody.kt similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/CommentInBody.kt rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/CommentInBody.kt diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/CommentInBody.kt.after b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/CommentInBody.kt.after similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/CommentInBody.kt.after rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/CommentInBody.kt.after diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/DeclarationInside.kt b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/DeclarationInside.kt similarity index 81% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/DeclarationInside.kt rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/DeclarationInside.kt index df53bc2b9ea..a118fdc0051 100644 --- a/idea/testData/intentions/deprecatedCallableAddReplaceWith/DeclarationInside.kt +++ b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/DeclarationInside.kt @@ -1,4 +1,4 @@ -// IS_APPLICABLE: false +// PROBLEM: none @Deprecated("") fun foo(p: Int) { if (p > 0) { diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/DeprecationLevelHidden.kt b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/DeprecationLevelHidden.kt similarity index 85% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/DeprecationLevelHidden.kt rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/DeprecationLevelHidden.kt index dbaf1d2c507..c193953a351 100644 --- a/idea/testData/intentions/deprecatedCallableAddReplaceWith/DeprecationLevelHidden.kt +++ b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/DeprecationLevelHidden.kt @@ -1,4 +1,4 @@ -// IS_APPLICABLE: false +// PROBLEM: none @Deprecated("Use the other version", level=DeprecationLevel.HIDDEN) fun foo(a: Int) { foo(a) } diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/ExceptionInPropertyDestructuringEntry.kt b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/ExceptionInPropertyDestructuringEntry.kt similarity index 75% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/ExceptionInPropertyDestructuringEntry.kt rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/ExceptionInPropertyDestructuringEntry.kt index 89f42034045..bd789055cf7 100644 --- a/idea/testData/intentions/deprecatedCallableAddReplaceWith/ExceptionInPropertyDestructuringEntry.kt +++ b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/ExceptionInPropertyDestructuringEntry.kt @@ -1,4 +1,4 @@ -// IS_APPLICABLE: false +// PROBLEM: none // See KT-7929, EA-76715 class C { diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/ExpressionBody.kt b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/ExpressionBody.kt similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/ExpressionBody.kt rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/ExpressionBody.kt diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/ExpressionBody.kt.after b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/ExpressionBody.kt.after similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/ExpressionBody.kt.after rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/ExpressionBody.kt.after diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/If.kt b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/If.kt similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/If.kt rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/If.kt diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/If.kt.after b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/If.kt.after similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/If.kt.after rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/If.kt.after diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/Imports.1.kt b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/Imports.1.kt similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/Imports.1.kt rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/Imports.1.kt diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/Imports.1.kt.after b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/Imports.1.kt.after similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/Imports.1.kt.after rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/Imports.1.kt.after diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/Imports.kt b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/Imports.kt similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/Imports.kt rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/Imports.kt diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/Imports.kt.after b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/Imports.kt.after similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/Imports.kt.after rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/Imports.kt.after diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/NoCompanionObjectImport.1.kt b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/NoCompanionObjectImport.1.kt similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/NoCompanionObjectImport.1.kt rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/NoCompanionObjectImport.1.kt diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/NoCompanionObjectImport.1.kt.after b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/NoCompanionObjectImport.1.kt.after similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/NoCompanionObjectImport.1.kt.after rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/NoCompanionObjectImport.1.kt.after diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/NoCompanionObjectImport.kt b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/NoCompanionObjectImport.kt similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/NoCompanionObjectImport.kt rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/NoCompanionObjectImport.kt diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/NoCompanionObjectImport.kt.after b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/NoCompanionObjectImport.kt.after similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/NoCompanionObjectImport.kt.after rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/NoCompanionObjectImport.kt.after diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/NoDefaultImport.kt b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/NoDefaultImport.kt similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/NoDefaultImport.kt rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/NoDefaultImport.kt diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/NoDefaultImport.kt.after b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/NoDefaultImport.kt.after similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/NoDefaultImport.kt.after rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/NoDefaultImport.kt.after diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/NoReturn.kt b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/NoReturn.kt similarity index 87% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/NoReturn.kt rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/NoReturn.kt index 9ffb554fbb5..91ef95f90ff 100644 --- a/idea/testData/intentions/deprecatedCallableAddReplaceWith/NoReturn.kt +++ b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/NoReturn.kt @@ -1,4 +1,4 @@ -// IS_APPLICABLE: false +// PROBLEM: none // ERROR: A 'return' expression required in a function with a block body ('{...}') @Deprecated("") diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/NotAvailableOnDocComment.kt b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/NotAvailableOnDocComment.kt similarity index 79% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/NotAvailableOnDocComment.kt rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/NotAvailableOnDocComment.kt index cd2d4ce45b2..e1351aadb95 100644 --- a/idea/testData/intentions/deprecatedCallableAddReplaceWith/NotAvailableOnDocComment.kt +++ b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/NotAvailableOnDocComment.kt @@ -1,4 +1,4 @@ -// IS_APPLICABLE: false +// PROBLEM: none /** * This is a doc-comment */ diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/PrivateSymbolUsed.kt b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/PrivateSymbolUsed.kt similarity index 83% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/PrivateSymbolUsed.kt rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/PrivateSymbolUsed.kt index 1e6fa397273..cb050aa3ce0 100644 --- a/idea/testData/intentions/deprecatedCallableAddReplaceWith/PrivateSymbolUsed.kt +++ b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/PrivateSymbolUsed.kt @@ -1,4 +1,4 @@ -// IS_APPLICABLE: false +// PROBLEM: none class C { private val v = 1 diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/QualifiedCall.kt b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/QualifiedCall.kt similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/QualifiedCall.kt rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/QualifiedCall.kt diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/QualifiedCall.kt.after b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/QualifiedCall.kt.after similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/QualifiedCall.kt.after rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/QualifiedCall.kt.after diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/Return.kt b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/Return.kt similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/Return.kt rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/Return.kt diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/Return.kt.after b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/Return.kt.after similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/Return.kt.after rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/Return.kt.after diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/ReturnInside.kt b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/ReturnInside.kt similarity index 77% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/ReturnInside.kt rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/ReturnInside.kt index d3db91d9aa8..dd11abdd05b 100644 --- a/idea/testData/intentions/deprecatedCallableAddReplaceWith/ReturnInside.kt +++ b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/ReturnInside.kt @@ -1,4 +1,4 @@ -// IS_APPLICABLE: false +// PROBLEM: none @Deprecated("") fun foo() { bar() ?: return diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/Simple.kt b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/Simple.kt similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/Simple.kt rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/Simple.kt diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/Simple.kt.after b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/Simple.kt.after similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/Simple.kt.after rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/Simple.kt.after diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/StringLiteral.kt b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/StringLiteral.kt similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/StringLiteral.kt rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/StringLiteral.kt diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/StringLiteral.kt.after b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/StringLiteral.kt.after similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/StringLiteral.kt.after rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/StringLiteral.kt.after diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/StringTemplate.kt b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/StringTemplate.kt similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/StringTemplate.kt rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/StringTemplate.kt diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/StringTemplate.kt.after b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/StringTemplate.kt.after similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/StringTemplate.kt.after rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/StringTemplate.kt.after diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/TwoStatements.kt b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/TwoStatements.kt similarity index 74% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/TwoStatements.kt rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/TwoStatements.kt index f70d9e0bb36..aabe63e1a23 100644 --- a/idea/testData/intentions/deprecatedCallableAddReplaceWith/TwoStatements.kt +++ b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/TwoStatements.kt @@ -1,4 +1,4 @@ -// IS_APPLICABLE: false +// PROBLEM: none @Deprecated("") fun foo() { bar() diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/ValProperty.kt b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/ValProperty.kt similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/ValProperty.kt rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/ValProperty.kt diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/ValProperty.kt.after b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/ValProperty.kt.after similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/ValProperty.kt.after rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/ValProperty.kt.after diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/ValPropertyWithReturn.kt b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/ValPropertyWithReturn.kt similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/ValPropertyWithReturn.kt rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/ValPropertyWithReturn.kt diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/ValPropertyWithReturn.kt.after b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/ValPropertyWithReturn.kt.after similarity index 100% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/ValPropertyWithReturn.kt.after rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/ValPropertyWithReturn.kt.after diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/destructuringWithLambdaInScript.kts b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/destructuringWithLambdaInScript.kts similarity index 83% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/destructuringWithLambdaInScript.kts rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/destructuringWithLambdaInScript.kts index b8e6fa2899d..5ad8c13c6bb 100644 --- a/idea/testData/intentions/deprecatedCallableAddReplaceWith/destructuringWithLambdaInScript.kts +++ b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/destructuringWithLambdaInScript.kts @@ -1,4 +1,4 @@ -// IS_APPLICABLE: false +// PROBLEM: none // WITH_RUNTIME // SKIP_ERRORS_BEFORE // SKIP_ERRORS_AFTER diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/inspectionData/expected.xml b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/inspectionData/expected.xml similarity index 60% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/inspectionData/expected.xml rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/inspectionData/expected.xml index 23de8979c51..caa8b824b00 100644 --- a/idea/testData/intentions/deprecatedCallableAddReplaceWith/inspectionData/expected.xml +++ b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/inspectionData/expected.xml @@ -4,8 +4,8 @@ 2 light_idea_test_case - Add 'replaceWith' argument to 'deprecated' annotation - Add 'replaceWith' argument to specify replacement pattern + @Deprecated annotation without 'replaceWith' argument + @Deprecated annotation without 'replaceWith' argument @@ -14,8 +14,8 @@ 2 light_idea_test_case - Add 'replaceWith' argument to 'deprecated' annotation - Add 'replaceWith' argument to specify replacement pattern + @Deprecated annotation without 'replaceWith' argument + @Deprecated annotation without 'replaceWith' argument @@ -23,8 +23,8 @@ 1 light_idea_test_case - Add 'replaceWith' argument to 'deprecated' annotation - Add 'replaceWith' argument to specify replacement pattern + @Deprecated annotation without 'replaceWith' argument + @Deprecated annotation without 'replaceWith' argument @@ -32,8 +32,8 @@ 1 light_idea_test_case - Add 'replaceWith' argument to 'deprecated' annotation - Add 'replaceWith' argument to specify replacement pattern + @Deprecated annotation without 'replaceWith' argument + @Deprecated annotation without 'replaceWith' argument @@ -41,8 +41,8 @@ 1 light_idea_test_case - Add 'replaceWith' argument to 'deprecated' annotation - Add 'replaceWith' argument to specify replacement pattern + @Deprecated annotation without 'replaceWith' argument + @Deprecated annotation without 'replaceWith' argument @@ -50,8 +50,8 @@ 1 light_idea_test_case - Add 'replaceWith' argument to 'deprecated' annotation - Add 'replaceWith' argument to specify replacement pattern + @Deprecated annotation without 'replaceWith' argument + @Deprecated annotation without 'replaceWith' argument @@ -59,8 +59,8 @@ 1 light_idea_test_case - Add 'replaceWith' argument to 'deprecated' annotation - Add 'replaceWith' argument to specify replacement pattern + @Deprecated annotation without 'replaceWith' argument + @Deprecated annotation without 'replaceWith' argument @@ -68,8 +68,8 @@ 5 light_idea_test_case - Add 'replaceWith' argument to 'deprecated' annotation - Add 'replaceWith' argument to specify replacement pattern + @Deprecated annotation without 'replaceWith' argument + @Deprecated annotation without 'replaceWith' argument @@ -77,8 +77,8 @@ 2 light_idea_test_case - Add 'replaceWith' argument to 'deprecated' annotation - Add 'replaceWith' argument to specify replacement pattern + @Deprecated annotation without 'replaceWith' argument + @Deprecated annotation without 'replaceWith' argument @@ -86,8 +86,8 @@ 5 light_idea_test_case - Add 'replaceWith' argument to 'deprecated' annotation - Add 'replaceWith' argument to specify replacement pattern + @Deprecated annotation without 'replaceWith' argument + @Deprecated annotation without 'replaceWith' argument @@ -95,8 +95,8 @@ 5 light_idea_test_case - Add 'replaceWith' argument to 'deprecated' annotation - Add 'replaceWith' argument to specify replacement pattern + @Deprecated annotation without 'replaceWith' argument + @Deprecated annotation without 'replaceWith' argument @@ -104,8 +104,8 @@ 1 light_idea_test_case - Add 'replaceWith' argument to 'deprecated' annotation - Add 'replaceWith' argument to specify replacement pattern + @Deprecated annotation without 'replaceWith' argument + @Deprecated annotation without 'replaceWith' argument @@ -113,8 +113,8 @@ 1 light_idea_test_case - Add 'replaceWith' argument to 'deprecated' annotation - Add 'replaceWith' argument to specify replacement pattern + @Deprecated annotation without 'replaceWith' argument + @Deprecated annotation without 'replaceWith' argument @@ -122,7 +122,7 @@ 1 light_idea_test_case - Add 'replaceWith' argument to 'deprecated' annotation - Add 'replaceWith' argument to specify replacement pattern + @Deprecated annotation without 'replaceWith' argument + @Deprecated annotation without 'replaceWith' argument \ No newline at end of file diff --git a/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/inspectionData/inspections.test b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/inspectionData/inspections.test new file mode 100644 index 00000000000..6fcdada27cf --- /dev/null +++ b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/inspectionData/inspections.test @@ -0,0 +1 @@ +// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.DeprecatedCallableAddReplaceWithInspection diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/justLambdaInScript.kts b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/justLambdaInScript.kts similarity index 81% rename from idea/testData/intentions/deprecatedCallableAddReplaceWith/justLambdaInScript.kts rename to idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/justLambdaInScript.kts index c7e81fed929..77f0cea166d 100644 --- a/idea/testData/intentions/deprecatedCallableAddReplaceWith/justLambdaInScript.kts +++ b/idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/justLambdaInScript.kts @@ -1,4 +1,4 @@ -// IS_APPLICABLE: false +// PROBLEM: none // WITH_RUNTIME // SKIP_ERRORS_BEFORE // SKIP_ERRORS_AFTER diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/.intention b/idea/testData/intentions/deprecatedCallableAddReplaceWith/.intention deleted file mode 100644 index d665c029dd4..00000000000 --- a/idea/testData/intentions/deprecatedCallableAddReplaceWith/.intention +++ /dev/null @@ -1 +0,0 @@ -org.jetbrains.kotlin.idea.intentions.DeprecatedCallableAddReplaceWithIntention diff --git a/idea/testData/intentions/deprecatedCallableAddReplaceWith/inspectionData/inspections.test b/idea/testData/intentions/deprecatedCallableAddReplaceWith/inspectionData/inspections.test deleted file mode 100644 index 3a8ac1e6cc5..00000000000 --- a/idea/testData/intentions/deprecatedCallableAddReplaceWith/inspectionData/inspections.test +++ /dev/null @@ -1 +0,0 @@ -// INSPECTION_CLASS: org.jetbrains.kotlin.idea.intentions.DeprecatedCallableAddReplaceWithInspection diff --git a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/InspectionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/InspectionTestGenerated.java index 0695aba4fbe..a4d4ae43a50 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/InspectionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/InspectionTestGenerated.java @@ -39,12 +39,6 @@ public class InspectionTestGenerated extends AbstractInspectionTest { doTest(fileName); } - @TestMetadata("deprecatedCallableAddReplaceWith/inspectionData/inspections.test") - public void testDeprecatedCallableAddReplaceWith_inspectionData_Inspections_test() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/inspectionData/inspections.test"); - doTest(fileName); - } - @TestMetadata("destructuringInLambda/inspectionData/inspections.test") public void testDestructuringInLambda_inspectionData_Inspections_test() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/destructuringInLambda/inspectionData/inspections.test"); @@ -507,6 +501,12 @@ public class InspectionTestGenerated extends AbstractInspectionTest { doTest(fileName); } + @TestMetadata("deprecatedCallableAddReplaceWith/inspectionData/inspections.test") + public void testDeprecatedCallableAddReplaceWith_inspectionData_Inspections_test() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/inspectionData/inspections.test"); + doTest(fileName); + } + @TestMetadata("simplifyNegatedBinaryExpression/inspectionData/inspections.test") public void testSimplifyNegatedBinaryExpression_inspectionData_Inspections_test() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/simplifyNegatedBinaryExpression/inspectionData/inspections.test"); diff --git a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java index 6ca16ffac15..656465d667a 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java @@ -1261,6 +1261,159 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest { } } + @TestMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class DeprecatedCallableAddReplaceWith extends AbstractLocalInspectionTest { + public void testAllFilesPresentInDeprecatedCallableAddReplaceWith() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); + } + + @TestMetadata("AlreadyWithReplaceWith.kt") + public void testAlreadyWithReplaceWith() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/AlreadyWithReplaceWith.kt"); + doTest(fileName); + } + + @TestMetadata("CommentInBody.kt") + public void testCommentInBody() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/CommentInBody.kt"); + doTest(fileName); + } + + @TestMetadata("DeclarationInside.kt") + public void testDeclarationInside() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/DeclarationInside.kt"); + doTest(fileName); + } + + @TestMetadata("DeprecationLevelHidden.kt") + public void testDeprecationLevelHidden() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/DeprecationLevelHidden.kt"); + doTest(fileName); + } + + @TestMetadata("destructuringWithLambdaInScript.kts") + public void testDestructuringWithLambdaInScript() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/destructuringWithLambdaInScript.kts"); + doTest(fileName); + } + + @TestMetadata("ExceptionInPropertyDestructuringEntry.kt") + public void testExceptionInPropertyDestructuringEntry() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/ExceptionInPropertyDestructuringEntry.kt"); + doTest(fileName); + } + + @TestMetadata("ExpressionBody.kt") + public void testExpressionBody() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/ExpressionBody.kt"); + doTest(fileName); + } + + @TestMetadata("If.kt") + public void testIf() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/If.kt"); + doTest(fileName); + } + + @TestMetadata("Imports.kt") + public void testImports() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/Imports.kt"); + doTest(fileName); + } + + @TestMetadata("justLambdaInScript.kts") + public void testJustLambdaInScript() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/justLambdaInScript.kts"); + doTest(fileName); + } + + @TestMetadata("NoCompanionObjectImport.kt") + public void testNoCompanionObjectImport() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/NoCompanionObjectImport.kt"); + doTest(fileName); + } + + @TestMetadata("NoDefaultImport.kt") + public void testNoDefaultImport() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/NoDefaultImport.kt"); + doTest(fileName); + } + + @TestMetadata("NoReturn.kt") + public void testNoReturn() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/NoReturn.kt"); + doTest(fileName); + } + + @TestMetadata("NotAvailableOnDocComment.kt") + public void testNotAvailableOnDocComment() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/NotAvailableOnDocComment.kt"); + doTest(fileName); + } + + @TestMetadata("PrivateSymbolUsed.kt") + public void testPrivateSymbolUsed() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/PrivateSymbolUsed.kt"); + doTest(fileName); + } + + @TestMetadata("QualifiedCall.kt") + public void testQualifiedCall() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/QualifiedCall.kt"); + doTest(fileName); + } + + @TestMetadata("Return.kt") + public void testReturn() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/Return.kt"); + doTest(fileName); + } + + @TestMetadata("ReturnInside.kt") + public void testReturnInside() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/ReturnInside.kt"); + doTest(fileName); + } + + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/Simple.kt"); + doTest(fileName); + } + + @TestMetadata("StringLiteral.kt") + public void testStringLiteral() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/StringLiteral.kt"); + doTest(fileName); + } + + @TestMetadata("StringTemplate.kt") + public void testStringTemplate() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/StringTemplate.kt"); + doTest(fileName); + } + + @TestMetadata("TwoStatements.kt") + public void testTwoStatements() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/TwoStatements.kt"); + doTest(fileName); + } + + @TestMetadata("ValProperty.kt") + public void testValProperty() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/ValProperty.kt"); + doTest(fileName); + } + + @TestMetadata("ValPropertyWithReturn.kt") + public void testValPropertyWithReturn() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/deprecatedCallableAddReplaceWith/ValPropertyWithReturn.kt"); + doTest(fileName); + } + } + @TestMetadata("idea/testData/inspectionsLocal/doubleNegation") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java index b4af64e0631..1b520e60aab 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java @@ -8383,159 +8383,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest { } } - @TestMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class DeprecatedCallableAddReplaceWith extends AbstractIntentionTest { - public void testAllFilesPresentInDeprecatedCallableAddReplaceWith() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/deprecatedCallableAddReplaceWith"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); - } - - @TestMetadata("AlreadyWithReplaceWith.kt") - public void testAlreadyWithReplaceWith() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/AlreadyWithReplaceWith.kt"); - doTest(fileName); - } - - @TestMetadata("CommentInBody.kt") - public void testCommentInBody() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/CommentInBody.kt"); - doTest(fileName); - } - - @TestMetadata("DeclarationInside.kt") - public void testDeclarationInside() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/DeclarationInside.kt"); - doTest(fileName); - } - - @TestMetadata("DeprecationLevelHidden.kt") - public void testDeprecationLevelHidden() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/DeprecationLevelHidden.kt"); - doTest(fileName); - } - - @TestMetadata("destructuringWithLambdaInScript.kts") - public void testDestructuringWithLambdaInScript() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/destructuringWithLambdaInScript.kts"); - doTest(fileName); - } - - @TestMetadata("ExceptionInPropertyDestructuringEntry.kt") - public void testExceptionInPropertyDestructuringEntry() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/ExceptionInPropertyDestructuringEntry.kt"); - doTest(fileName); - } - - @TestMetadata("ExpressionBody.kt") - public void testExpressionBody() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/ExpressionBody.kt"); - doTest(fileName); - } - - @TestMetadata("If.kt") - public void testIf() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/If.kt"); - doTest(fileName); - } - - @TestMetadata("Imports.kt") - public void testImports() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/Imports.kt"); - doTest(fileName); - } - - @TestMetadata("justLambdaInScript.kts") - public void testJustLambdaInScript() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/justLambdaInScript.kts"); - doTest(fileName); - } - - @TestMetadata("NoCompanionObjectImport.kt") - public void testNoCompanionObjectImport() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/NoCompanionObjectImport.kt"); - doTest(fileName); - } - - @TestMetadata("NoDefaultImport.kt") - public void testNoDefaultImport() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/NoDefaultImport.kt"); - doTest(fileName); - } - - @TestMetadata("NoReturn.kt") - public void testNoReturn() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/NoReturn.kt"); - doTest(fileName); - } - - @TestMetadata("NotAvailableOnDocComment.kt") - public void testNotAvailableOnDocComment() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/NotAvailableOnDocComment.kt"); - doTest(fileName); - } - - @TestMetadata("PrivateSymbolUsed.kt") - public void testPrivateSymbolUsed() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/PrivateSymbolUsed.kt"); - doTest(fileName); - } - - @TestMetadata("QualifiedCall.kt") - public void testQualifiedCall() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/QualifiedCall.kt"); - doTest(fileName); - } - - @TestMetadata("Return.kt") - public void testReturn() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/Return.kt"); - doTest(fileName); - } - - @TestMetadata("ReturnInside.kt") - public void testReturnInside() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/ReturnInside.kt"); - doTest(fileName); - } - - @TestMetadata("Simple.kt") - public void testSimple() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/Simple.kt"); - doTest(fileName); - } - - @TestMetadata("StringLiteral.kt") - public void testStringLiteral() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/StringLiteral.kt"); - doTest(fileName); - } - - @TestMetadata("StringTemplate.kt") - public void testStringTemplate() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/StringTemplate.kt"); - doTest(fileName); - } - - @TestMetadata("TwoStatements.kt") - public void testTwoStatements() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/TwoStatements.kt"); - doTest(fileName); - } - - @TestMetadata("ValProperty.kt") - public void testValProperty() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/ValProperty.kt"); - doTest(fileName); - } - - @TestMetadata("ValPropertyWithReturn.kt") - public void testValPropertyWithReturn() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/deprecatedCallableAddReplaceWith/ValPropertyWithReturn.kt"); - doTest(fileName); - } - } - @TestMetadata("idea/testData/intentions/destructuringInLambda") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)