Make DeprecatedCallableAddReplaceWithInspection applicability based

Removes intention version of the same thing
Includes some optimization of 'Deprecated' annotation detection
This commit is contained in:
Mikhail Glukhikh
2018-03-27 16:53:20 +03:00
parent ab973b2ff0
commit 2125c42328
54 changed files with 245 additions and 262 deletions
@@ -1,4 +0,0 @@
@deprecated("Use newFun instead", <spot>ReplaceWith("newFun(null)")</spot>)
fun oldFun(): Int {
return newFun(null)
}
@@ -1,4 +0,0 @@
@deprecated("Use newFun instead")
fun oldFun(): Int {
return newFun(null)
}
@@ -1,5 +0,0 @@
<html>
<body>
This intention adds a <b>kotlin.ReplaceWith</b> argument to a <b>kotlin.deprecated</b> annotation on a function or a property based on its body.
</body>
</html>
+1 -6
View File
@@ -1203,11 +1203,6 @@
<category>Kotlin</category>
</intentionAction>
<intentionAction>
<className>org.jetbrains.kotlin.idea.intentions.DeprecatedCallableAddReplaceWithIntention</className>
<category>Kotlin</category>
</intentionAction>
<intentionAction>
<className>org.jetbrains.kotlin.idea.intentions.AddNameToArgumentIntention</className>
<category>Kotlin</category>
@@ -1605,7 +1600,7 @@
language="kotlin"
/>
<localInspection implementationClass="org.jetbrains.kotlin.idea.intentions.DeprecatedCallableAddReplaceWithInspection"
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.DeprecatedCallableAddReplaceWithInspection"
displayName="@Deprecated annotation without 'replaceWith' argument"
groupPath="Kotlin"
groupName="Other problems"
@@ -1,23 +1,13 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea.intentions
package org.jetbrains.kotlin.idea.inspections
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.util.TextRange
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiElement
import com.intellij.psi.codeStyle.CodeStyleManager
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.descriptors.DeclarationDescriptorWithVisibility
@@ -31,9 +21,9 @@ import org.jetbrains.kotlin.idea.core.ShortenReferences
import org.jetbrains.kotlin.idea.core.moveCaret
import org.jetbrains.kotlin.idea.core.unblockDocument
import org.jetbrains.kotlin.idea.imports.importableFqName
import org.jetbrains.kotlin.idea.inspections.IntentionBasedInspection
import org.jetbrains.kotlin.idea.util.ImportInsertHelper
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.getParentOfType
import org.jetbrains.kotlin.psi.psiUtil.getReceiverExpression
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.DescriptorUtils
@@ -45,30 +35,35 @@ import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
import org.jetbrains.kotlin.types.typeUtil.isUnit
import java.util.*
class DeprecatedCallableAddReplaceWithInspection : IntentionBasedInspection<KtCallableDeclaration>(DeprecatedCallableAddReplaceWithIntention::class)
class DeprecatedCallableAddReplaceWithIntention : SelfTargetingRangeIntention<KtCallableDeclaration>(
KtCallableDeclaration::class.java, "Add 'replaceWith' argument to specify replacement pattern", "Add 'replaceWith' argument to 'Deprecated' annotation"
class DeprecatedCallableAddReplaceWithInspection : AbstractApplicabilityBasedInspection<KtCallableDeclaration>(
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<KtCallableDeclaration>(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<Kt
}
private fun KtCallableDeclaration.deprecatedAnnotationWithNoReplaceWith(): KtAnnotationEntry? {
val bindingContext = this.analyze()
// val deprecatedConstructor = KotlinBuiltIns.getInstance().getDeprecatedAnnotation().getUnsubstitutedPrimaryConstructor()
for (entry in annotationEntries) {
entry.analyze()
if (entry.shortName != DEPRECATED_NAME) continue
val bindingContext = entry.analyze()
val resolvedCall = entry.calleeExpression.getResolvedCall(bindingContext) ?: continue
if (!resolvedCall.isReallySuccess()) continue
// if (resolvedCall.getResultingDescriptor() != deprecatedConstructor) continue
//TODO
val descriptor = resolvedCall.resultingDescriptor.containingDeclaration
val descriptorFqName = DescriptorUtils.getFqName(descriptor).toSafe()
if (descriptorFqName != KotlinBuiltIns.FQ_NAMES.deprecated) continue
@@ -125,7 +117,7 @@ class DeprecatedCallableAddReplaceWithIntention : SelfTargetingRangeIntention<Kt
val replaceWithArguments = args["replaceWith"] /*TODO: kotlin.deprecated::replaceWith.name*/
val level = args["level"]
if (replaceWithArguments?.arguments?.isNotEmpty() ?: false) return null
if (replaceWithArguments?.arguments?.isNotEmpty() == true) return null
if (level != null && level.arguments.isNotEmpty()) {
val levelDescriptor = level.arguments[0].getArgumentExpression().getResolvedCall(bindingContext)?.candidateDescriptor
@@ -150,7 +142,7 @@ class DeprecatedCallableAddReplaceWithIntention : SelfTargetingRangeIntention<Kt
} ?: return null
var isGood = true
replacementExpression.accept(object: KtVisitorVoid(){
replacementExpression.accept(object : KtVisitorVoid() {
override fun visitReturnExpression(expression: KtReturnExpression) {
isGood = false
}
@@ -185,13 +177,17 @@ class DeprecatedCallableAddReplaceWithIntention : SelfTargetingRangeIntention<Kt
val text = replacementExpression.text
var expression = try {
KtPsiFactory(this).createExpression(text.replace('\n', ' '))
}
catch(e: Throwable) { // does not parse in one line
} catch (e: Throwable) { // does not parse in one line
return null
}
expression = CodeStyleManager.getInstance(project).reformat(expression, true) as KtExpression
return ReplaceWith(expression.text, *extractImports(replacementExpression).toTypedArray())
return ReplaceWith(
expression.text,
*extractImports(
replacementExpression
).toTypedArray()
)
}
private fun KtDeclarationWithBody.replacementExpressionFromBody(): KtExpression? {
@@ -212,7 +208,7 @@ class DeprecatedCallableAddReplaceWithIntention : SelfTargetingRangeIntention<Kt
val importHelper = ImportInsertHelper.getInstance(expression.project)
val result = ArrayList<String>()
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<Kt
if (target.isExtension || expression.getReceiverExpression() == null) {
val fqName = target.importableFqName ?: return
if (!importHelper.isImportedWithDefault(ImportPath(fqName, false), file)
&& (target.containingDeclaration as? PackageFragmentDescriptor)?.fqName != currentPackageFqName) {
&& (target.containingDeclaration as? PackageFragmentDescriptor)?.fqName != currentPackageFqName
) {
result.add(fqName.asString())
}
}
@@ -233,4 +230,8 @@ class DeprecatedCallableAddReplaceWithIntention : SelfTargetingRangeIntention<Kt
})
return result
}
companion object {
val DEPRECATED_NAME = KotlinBuiltIns.FQ_NAMES.deprecated.shortName()
}
}
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.inspections.DeprecatedCallableAddReplaceWithInspection
@@ -1,4 +1,4 @@
// IS_APPLICABLE: false
// PROBLEM: none
<caret>@Deprecated("", ReplaceWith("bar()"))
fun foo() {
bar()
@@ -1,4 +1,4 @@
// IS_APPLICABLE: false
// PROBLEM: none
<caret>@Deprecated("")
fun foo(p: Int) {
if (p > 0) {
@@ -1,4 +1,4 @@
// IS_APPLICABLE: false
// PROBLEM: none
<caret>@Deprecated("Use the other version", level=DeprecationLevel.HIDDEN)
fun foo(a: Int) { foo(a) }
@@ -1,4 +1,4 @@
// IS_APPLICABLE: false
// PROBLEM: none
// ERROR: A 'return' expression required in a function with a block body ('{...}')
<caret>@Deprecated("")
@@ -1,4 +1,4 @@
// IS_APPLICABLE: false
// PROBLEM: none
/**
* <caret>This is a doc-comment
*/
@@ -1,4 +1,4 @@
// IS_APPLICABLE: false
// PROBLEM: none
class C {
private val v = 1
@@ -1,4 +1,4 @@
// IS_APPLICABLE: false
// PROBLEM: none
<caret>@Deprecated("")
fun foo() {
bar() ?: return
@@ -1,4 +1,4 @@
// IS_APPLICABLE: false
// PROBLEM: none
<caret>@Deprecated("")
fun foo() {
bar()
@@ -1,4 +1,4 @@
// IS_APPLICABLE: false
// PROBLEM: none
// WITH_RUNTIME
// SKIP_ERRORS_BEFORE
// SKIP_ERRORS_AFTER
@@ -4,8 +4,8 @@
<line>2</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="ValPropertyWithReturn.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Add 'replaceWith' argument to 'deprecated' annotation</problem_class>
<description>Add 'replaceWith' argument to specify replacement pattern</description>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">@Deprecated annotation without 'replaceWith' argument</problem_class>
<description>@Deprecated annotation without 'replaceWith' argument</description>
</problem>
@@ -14,8 +14,8 @@
<line>2</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="ValProperty.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Add 'replaceWith' argument to 'deprecated' annotation</problem_class>
<description>Add 'replaceWith' argument to specify replacement pattern</description>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">@Deprecated annotation without 'replaceWith' argument</problem_class>
<description>@Deprecated annotation without 'replaceWith' argument</description>
</problem>
<problem>
@@ -23,8 +23,8 @@
<line>1</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="StringTemplate.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Add 'replaceWith' argument to 'deprecated' annotation</problem_class>
<description>Add 'replaceWith' argument to specify replacement pattern</description>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">@Deprecated annotation without 'replaceWith' argument</problem_class>
<description>@Deprecated annotation without 'replaceWith' argument</description>
</problem>
<problem>
@@ -32,8 +32,8 @@
<line>1</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="StringLiteral.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Add 'replaceWith' argument to 'deprecated' annotation</problem_class>
<description>Add 'replaceWith' argument to specify replacement pattern</description>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">@Deprecated annotation without 'replaceWith' argument</problem_class>
<description>@Deprecated annotation without 'replaceWith' argument</description>
</problem>
<problem>
@@ -41,8 +41,8 @@
<line>1</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="Simple.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Add 'replaceWith' argument to 'deprecated' annotation</problem_class>
<description>Add 'replaceWith' argument to specify replacement pattern</description>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">@Deprecated annotation without 'replaceWith' argument</problem_class>
<description>@Deprecated annotation without 'replaceWith' argument</description>
</problem>
<problem>
@@ -50,8 +50,8 @@
<line>1</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="Return.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Add 'replaceWith' argument to 'deprecated' annotation</problem_class>
<description>Add 'replaceWith' argument to specify replacement pattern</description>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">@Deprecated annotation without 'replaceWith' argument</problem_class>
<description>@Deprecated annotation without 'replaceWith' argument</description>
</problem>
<problem>
@@ -59,8 +59,8 @@
<line>1</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="QualifiedCall.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Add 'replaceWith' argument to 'deprecated' annotation</problem_class>
<description>Add 'replaceWith' argument to specify replacement pattern</description>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">@Deprecated annotation without 'replaceWith' argument</problem_class>
<description>@Deprecated annotation without 'replaceWith' argument</description>
</problem>
<problem>
@@ -68,8 +68,8 @@
<line>5</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="NotAvailableOnDocComment.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Add 'replaceWith' argument to 'deprecated' annotation</problem_class>
<description>Add 'replaceWith' argument to specify replacement pattern</description>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">@Deprecated annotation without 'replaceWith' argument</problem_class>
<description>@Deprecated annotation without 'replaceWith' argument</description>
</problem>
<problem>
@@ -77,8 +77,8 @@
<line>2</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="NoDefaultImport.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Add 'replaceWith' argument to 'deprecated' annotation</problem_class>
<description>Add 'replaceWith' argument to specify replacement pattern</description>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">@Deprecated annotation without 'replaceWith' argument</problem_class>
<description>@Deprecated annotation without 'replaceWith' argument</description>
</problem>
<problem>
@@ -86,8 +86,8 @@
<line>5</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="NoCompanionObjectImport.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Add 'replaceWith' argument to 'deprecated' annotation</problem_class>
<description>Add 'replaceWith' argument to specify replacement pattern</description>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">@Deprecated annotation without 'replaceWith' argument</problem_class>
<description>@Deprecated annotation without 'replaceWith' argument</description>
</problem>
<problem>
@@ -95,8 +95,8 @@
<line>5</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="Imports.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Add 'replaceWith' argument to 'deprecated' annotation</problem_class>
<description>Add 'replaceWith' argument to specify replacement pattern</description>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">@Deprecated annotation without 'replaceWith' argument</problem_class>
<description>@Deprecated annotation without 'replaceWith' argument</description>
</problem>
<problem>
@@ -104,8 +104,8 @@
<line>1</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="If.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Add 'replaceWith' argument to 'deprecated' annotation</problem_class>
<description>Add 'replaceWith' argument to specify replacement pattern</description>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">@Deprecated annotation without 'replaceWith' argument</problem_class>
<description>@Deprecated annotation without 'replaceWith' argument</description>
</problem>
<problem>
@@ -113,8 +113,8 @@
<line>1</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="ExpressionBody.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Add 'replaceWith' argument to 'deprecated' annotation</problem_class>
<description>Add 'replaceWith' argument to specify replacement pattern</description>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">@Deprecated annotation without 'replaceWith' argument</problem_class>
<description>@Deprecated annotation without 'replaceWith' argument</description>
</problem>
<problem>
@@ -122,7 +122,7 @@
<line>1</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="CommentInBody.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Add 'replaceWith' argument to 'deprecated' annotation</problem_class>
<description>Add 'replaceWith' argument to specify replacement pattern</description>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">@Deprecated annotation without 'replaceWith' argument</problem_class>
<description>@Deprecated annotation without 'replaceWith' argument</description>
</problem>
</problems>
@@ -0,0 +1 @@
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.DeprecatedCallableAddReplaceWithInspection
@@ -1,4 +1,4 @@
// IS_APPLICABLE: false
// PROBLEM: none
// WITH_RUNTIME
// SKIP_ERRORS_BEFORE
// SKIP_ERRORS_AFTER
@@ -1 +0,0 @@
org.jetbrains.kotlin.idea.intentions.DeprecatedCallableAddReplaceWithIntention
@@ -1 +0,0 @@
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.intentions.DeprecatedCallableAddReplaceWithInspection
@@ -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");
@@ -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)
@@ -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)