From 9e919829c89454637f0f20aa9632562d290a6a07 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 20 Dec 2017 20:59:59 +0300 Subject: [PATCH] Refactoring: "simplify assert not null" is now an inspection --- .../after.kt.template | 1 - .../before.kt.template | 2 - .../description.html | 6 -- idea/src/META-INF/plugin.xml | 7 +- .../SimplifyAssertNotNullInspection.kt} | 62 +++++++++------ .../kotlin/idea/j2k/J2kPostProcessings.kt | 2 +- .../simplifyAssertNotNull/.inspection | 1 + .../simplifyAssertNotNull/comments.kt | 2 +- .../simplifyAssertNotNull/comments.kt.after | 2 +- .../commentsNoMessage.kt | 2 +- .../commentsNoMessage.kt.after | 2 +- .../complicatedMessageLambda.kt | 2 +- .../simplifyAssertNotNull/eqNull.kt | 2 +- .../errorFunctionInContext.kt | 2 +- .../errorFunctionInContext.kt.after | 2 +- .../simplifyAssertNotNull/falseAssert.kt | 2 +- .../simplifyAssertNotNull/noMessage.kt | 2 +- .../simplifyAssertNotNull/noMessage.kt.after | 2 +- .../simplifyAssertNotNull/otherVariable.kt | 2 +- .../simplifyAssertNotNull/qualifiedAccess.kt | 2 +- .../simplifyAssertNotNull/withMessage.kt | 2 +- .../withMessage.kt.after | 2 +- .../withMessageLambdaOutside.kt | 2 +- .../withMessageLambdaOutside.kt.after | 2 +- .../simplifyAssertNotNull/.intention | 1 - .../LocalInspectionTestGenerated.java | 75 +++++++++++++++++++ .../intentions/IntentionTestGenerated.java | 75 ------------------- 27 files changed, 134 insertions(+), 132 deletions(-) delete mode 100644 idea/resources/intentionDescriptions/SimplifyAssertNotNullIntention/after.kt.template delete mode 100644 idea/resources/intentionDescriptions/SimplifyAssertNotNullIntention/before.kt.template delete mode 100644 idea/resources/intentionDescriptions/SimplifyAssertNotNullIntention/description.html rename idea/src/org/jetbrains/kotlin/idea/{intentions/SimplifyAssertNotNullIntention.kt => inspections/SimplifyAssertNotNullInspection.kt} (69%) create mode 100644 idea/testData/inspectionsLocal/simplifyAssertNotNull/.inspection rename idea/testData/{intentions => inspectionsLocal}/simplifyAssertNotNull/comments.kt (80%) rename idea/testData/{intentions => inspectionsLocal}/simplifyAssertNotNull/comments.kt.after (79%) rename idea/testData/{intentions => inspectionsLocal}/simplifyAssertNotNull/commentsNoMessage.kt (77%) rename idea/testData/{intentions => inspectionsLocal}/simplifyAssertNotNull/commentsNoMessage.kt.after (75%) rename idea/testData/{intentions => inspectionsLocal}/simplifyAssertNotNull/complicatedMessageLambda.kt (84%) rename idea/testData/{intentions => inspectionsLocal}/simplifyAssertNotNull/eqNull.kt (79%) rename idea/testData/{intentions => inspectionsLocal}/simplifyAssertNotNull/errorFunctionInContext.kt (77%) rename idea/testData/{intentions => inspectionsLocal}/simplifyAssertNotNull/errorFunctionInContext.kt.after (76%) rename idea/testData/{intentions => inspectionsLocal}/simplifyAssertNotNull/falseAssert.kt (86%) rename idea/testData/{intentions => inspectionsLocal}/simplifyAssertNotNull/noMessage.kt (65%) rename idea/testData/{intentions => inspectionsLocal}/simplifyAssertNotNull/noMessage.kt.after (60%) rename idea/testData/{intentions => inspectionsLocal}/simplifyAssertNotNull/otherVariable.kt (82%) rename idea/testData/{intentions => inspectionsLocal}/simplifyAssertNotNull/qualifiedAccess.kt (85%) rename idea/testData/{intentions => inspectionsLocal}/simplifyAssertNotNull/withMessage.kt (70%) rename idea/testData/{intentions => inspectionsLocal}/simplifyAssertNotNull/withMessage.kt.after (67%) rename idea/testData/{intentions => inspectionsLocal}/simplifyAssertNotNull/withMessageLambdaOutside.kt (70%) rename idea/testData/{intentions => inspectionsLocal}/simplifyAssertNotNull/withMessageLambdaOutside.kt.after (67%) delete mode 100644 idea/testData/intentions/simplifyAssertNotNull/.intention diff --git a/idea/resources/intentionDescriptions/SimplifyAssertNotNullIntention/after.kt.template b/idea/resources/intentionDescriptions/SimplifyAssertNotNullIntention/after.kt.template deleted file mode 100644 index 08d451cc0de..00000000000 --- a/idea/resources/intentionDescriptions/SimplifyAssertNotNullIntention/after.kt.template +++ /dev/null @@ -1 +0,0 @@ -val v = something()!! diff --git a/idea/resources/intentionDescriptions/SimplifyAssertNotNullIntention/before.kt.template b/idea/resources/intentionDescriptions/SimplifyAssertNotNullIntention/before.kt.template deleted file mode 100644 index 4cde255db35..00000000000 --- a/idea/resources/intentionDescriptions/SimplifyAssertNotNullIntention/before.kt.template +++ /dev/null @@ -1,2 +0,0 @@ -val v = something() -assert(v != null) diff --git a/idea/resources/intentionDescriptions/SimplifyAssertNotNullIntention/description.html b/idea/resources/intentionDescriptions/SimplifyAssertNotNullIntention/description.html deleted file mode 100644 index 97c6492320f..00000000000 --- a/idea/resources/intentionDescriptions/SimplifyAssertNotNullIntention/description.html +++ /dev/null @@ -1,6 +0,0 @@ - - -This intention replaces an 'assert' call which checks that a variable declared above has non-null value -with use of '!!' or '?:' operator in the variable initializer. - - \ No newline at end of file diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index 8c2745e6207..09109693fb7 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -782,11 +782,6 @@ Kotlin - - org.jetbrains.kotlin.idea.intentions.SimplifyAssertNotNullIntention - Kotlin - - org.jetbrains.kotlin.idea.intentions.ImportMemberIntention Kotlin @@ -1546,7 +1541,7 @@ language="kotlin" /> - (SimplifyAssertNotNullIntention::class) +class SimplifyAssertNotNullInspection : AbstractApplicabilityBasedInspection() { + override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean, session: LocalInspectionToolSession): KtVisitorVoid = + object : KtVisitorVoid() { + override fun visitCallExpression(expression: KtCallExpression) { + super.visitCallExpression(expression) + visitTargetElement(expression, holder, isOnTheFly) + } + } -class SimplifyAssertNotNullIntention : SelfTargetingOffsetIndependentIntention( - KtCallExpression::class.java, - "Replace assert with '!!' or '?:'" -) { - override fun isApplicableTo(element: KtCallExpression): Boolean { + override fun isApplicable(element: KtCallExpression): Boolean { if ((element.calleeExpression as? KtNameReferenceExpression)?.getReferencedName() != "assert") return false val arguments = element.valueArguments @@ -62,38 +68,48 @@ class SimplifyAssertNotNullIntention : SelfTargetingOffsetIndependentIntention(Errors.USELESS_CAST) { element, _ -> diff --git a/idea/testData/inspectionsLocal/simplifyAssertNotNull/.inspection b/idea/testData/inspectionsLocal/simplifyAssertNotNull/.inspection new file mode 100644 index 00000000000..0c32ef26ba8 --- /dev/null +++ b/idea/testData/inspectionsLocal/simplifyAssertNotNull/.inspection @@ -0,0 +1 @@ +org.jetbrains.kotlin.idea.inspections.SimplifyAssertNotNullInspection diff --git a/idea/testData/intentions/simplifyAssertNotNull/comments.kt b/idea/testData/inspectionsLocal/simplifyAssertNotNull/comments.kt similarity index 80% rename from idea/testData/intentions/simplifyAssertNotNull/comments.kt rename to idea/testData/inspectionsLocal/simplifyAssertNotNull/comments.kt index 97ee68dcb2b..7a0ff3f50d3 100644 --- a/idea/testData/intentions/simplifyAssertNotNull/comments.kt +++ b/idea/testData/inspectionsLocal/simplifyAssertNotNull/comments.kt @@ -1,4 +1,4 @@ -// INTENTION_TEXT: "Replace with '?: error(...)'" +// FIX: "Replace with '?: error(...)'" // WITH_RUNTIME fun foo(p: Array) { diff --git a/idea/testData/intentions/simplifyAssertNotNull/comments.kt.after b/idea/testData/inspectionsLocal/simplifyAssertNotNull/comments.kt.after similarity index 79% rename from idea/testData/intentions/simplifyAssertNotNull/comments.kt.after rename to idea/testData/inspectionsLocal/simplifyAssertNotNull/comments.kt.after index 2298b23f8e6..869f20459b3 100644 --- a/idea/testData/intentions/simplifyAssertNotNull/comments.kt.after +++ b/idea/testData/inspectionsLocal/simplifyAssertNotNull/comments.kt.after @@ -1,4 +1,4 @@ -// INTENTION_TEXT: "Replace with '?: error(...)'" +// FIX: "Replace with '?: error(...)'" // WITH_RUNTIME fun foo(p: Array) { diff --git a/idea/testData/intentions/simplifyAssertNotNull/commentsNoMessage.kt b/idea/testData/inspectionsLocal/simplifyAssertNotNull/commentsNoMessage.kt similarity index 77% rename from idea/testData/intentions/simplifyAssertNotNull/commentsNoMessage.kt rename to idea/testData/inspectionsLocal/simplifyAssertNotNull/commentsNoMessage.kt index a8e76a29ece..1f1deabc966 100644 --- a/idea/testData/intentions/simplifyAssertNotNull/commentsNoMessage.kt +++ b/idea/testData/inspectionsLocal/simplifyAssertNotNull/commentsNoMessage.kt @@ -1,4 +1,4 @@ -// INTENTION_TEXT: "Replace with '!!' operator" +// FIX: "Replace with '!!' operator" // WITH_RUNTIME fun foo(p: Array) { diff --git a/idea/testData/intentions/simplifyAssertNotNull/commentsNoMessage.kt.after b/idea/testData/inspectionsLocal/simplifyAssertNotNull/commentsNoMessage.kt.after similarity index 75% rename from idea/testData/intentions/simplifyAssertNotNull/commentsNoMessage.kt.after rename to idea/testData/inspectionsLocal/simplifyAssertNotNull/commentsNoMessage.kt.after index a7558c264de..c081f6e972e 100644 --- a/idea/testData/intentions/simplifyAssertNotNull/commentsNoMessage.kt.after +++ b/idea/testData/inspectionsLocal/simplifyAssertNotNull/commentsNoMessage.kt.after @@ -1,4 +1,4 @@ -// INTENTION_TEXT: "Replace with '!!' operator" +// FIX: "Replace with '!!' operator" // WITH_RUNTIME fun foo(p: Array) { diff --git a/idea/testData/intentions/simplifyAssertNotNull/complicatedMessageLambda.kt b/idea/testData/inspectionsLocal/simplifyAssertNotNull/complicatedMessageLambda.kt similarity index 84% rename from idea/testData/intentions/simplifyAssertNotNull/complicatedMessageLambda.kt rename to idea/testData/inspectionsLocal/simplifyAssertNotNull/complicatedMessageLambda.kt index 324f0acd8aa..30c5774c44e 100644 --- a/idea/testData/intentions/simplifyAssertNotNull/complicatedMessageLambda.kt +++ b/idea/testData/inspectionsLocal/simplifyAssertNotNull/complicatedMessageLambda.kt @@ -1,4 +1,4 @@ -// IS_APPLICABLE: false +// PROBLEM: none // WITH_RUNTIME fun foo(p: Array) { diff --git a/idea/testData/intentions/simplifyAssertNotNull/eqNull.kt b/idea/testData/inspectionsLocal/simplifyAssertNotNull/eqNull.kt similarity index 79% rename from idea/testData/intentions/simplifyAssertNotNull/eqNull.kt rename to idea/testData/inspectionsLocal/simplifyAssertNotNull/eqNull.kt index bddbd813648..7f0c9bd21da 100644 --- a/idea/testData/intentions/simplifyAssertNotNull/eqNull.kt +++ b/idea/testData/inspectionsLocal/simplifyAssertNotNull/eqNull.kt @@ -1,4 +1,4 @@ -// IS_APPLICABLE: false +// PROBLEM: none // WITH_RUNTIME fun foo(p: Array) { diff --git a/idea/testData/intentions/simplifyAssertNotNull/errorFunctionInContext.kt b/idea/testData/inspectionsLocal/simplifyAssertNotNull/errorFunctionInContext.kt similarity index 77% rename from idea/testData/intentions/simplifyAssertNotNull/errorFunctionInContext.kt rename to idea/testData/inspectionsLocal/simplifyAssertNotNull/errorFunctionInContext.kt index 863a68c9d49..d450e53bc70 100644 --- a/idea/testData/intentions/simplifyAssertNotNull/errorFunctionInContext.kt +++ b/idea/testData/inspectionsLocal/simplifyAssertNotNull/errorFunctionInContext.kt @@ -1,4 +1,4 @@ -// INTENTION_TEXT: "Replace with '?: error(...)'" +// FIX: "Replace with '?: error(...)'" // WITH_RUNTIME class C { diff --git a/idea/testData/intentions/simplifyAssertNotNull/errorFunctionInContext.kt.after b/idea/testData/inspectionsLocal/simplifyAssertNotNull/errorFunctionInContext.kt.after similarity index 76% rename from idea/testData/intentions/simplifyAssertNotNull/errorFunctionInContext.kt.after rename to idea/testData/inspectionsLocal/simplifyAssertNotNull/errorFunctionInContext.kt.after index 3cf63493336..e911e374bf9 100644 --- a/idea/testData/intentions/simplifyAssertNotNull/errorFunctionInContext.kt.after +++ b/idea/testData/inspectionsLocal/simplifyAssertNotNull/errorFunctionInContext.kt.after @@ -1,4 +1,4 @@ -// INTENTION_TEXT: "Replace with '?: error(...)'" +// FIX: "Replace with '?: error(...)'" // WITH_RUNTIME class C { diff --git a/idea/testData/intentions/simplifyAssertNotNull/falseAssert.kt b/idea/testData/inspectionsLocal/simplifyAssertNotNull/falseAssert.kt similarity index 86% rename from idea/testData/intentions/simplifyAssertNotNull/falseAssert.kt rename to idea/testData/inspectionsLocal/simplifyAssertNotNull/falseAssert.kt index 5c73e4e31fb..4096b33d125 100644 --- a/idea/testData/intentions/simplifyAssertNotNull/falseAssert.kt +++ b/idea/testData/inspectionsLocal/simplifyAssertNotNull/falseAssert.kt @@ -1,4 +1,4 @@ -// IS_APPLICABLE: false +// PROBLEM: none // WITH_RUNTIME class C { diff --git a/idea/testData/intentions/simplifyAssertNotNull/noMessage.kt b/idea/testData/inspectionsLocal/simplifyAssertNotNull/noMessage.kt similarity index 65% rename from idea/testData/intentions/simplifyAssertNotNull/noMessage.kt rename to idea/testData/inspectionsLocal/simplifyAssertNotNull/noMessage.kt index 777ffc44220..dc7a18c78de 100644 --- a/idea/testData/intentions/simplifyAssertNotNull/noMessage.kt +++ b/idea/testData/inspectionsLocal/simplifyAssertNotNull/noMessage.kt @@ -1,4 +1,4 @@ -// INTENTION_TEXT: "Replace with '!!' operator" +// FIX: "Replace with '!!' operator" // WITH_RUNTIME fun foo(p: Array) { diff --git a/idea/testData/intentions/simplifyAssertNotNull/noMessage.kt.after b/idea/testData/inspectionsLocal/simplifyAssertNotNull/noMessage.kt.after similarity index 60% rename from idea/testData/intentions/simplifyAssertNotNull/noMessage.kt.after rename to idea/testData/inspectionsLocal/simplifyAssertNotNull/noMessage.kt.after index d9ef8b5993f..b2068220f49 100644 --- a/idea/testData/intentions/simplifyAssertNotNull/noMessage.kt.after +++ b/idea/testData/inspectionsLocal/simplifyAssertNotNull/noMessage.kt.after @@ -1,4 +1,4 @@ -// INTENTION_TEXT: "Replace with '!!' operator" +// FIX: "Replace with '!!' operator" // WITH_RUNTIME fun foo(p: Array) { diff --git a/idea/testData/intentions/simplifyAssertNotNull/otherVariable.kt b/idea/testData/inspectionsLocal/simplifyAssertNotNull/otherVariable.kt similarity index 82% rename from idea/testData/intentions/simplifyAssertNotNull/otherVariable.kt rename to idea/testData/inspectionsLocal/simplifyAssertNotNull/otherVariable.kt index 17668c35e1e..d556ea51900 100644 --- a/idea/testData/intentions/simplifyAssertNotNull/otherVariable.kt +++ b/idea/testData/inspectionsLocal/simplifyAssertNotNull/otherVariable.kt @@ -1,4 +1,4 @@ -// IS_APPLICABLE: false +// PROBLEM: none // WITH_RUNTIME fun foo(p: Array) { diff --git a/idea/testData/intentions/simplifyAssertNotNull/qualifiedAccess.kt b/idea/testData/inspectionsLocal/simplifyAssertNotNull/qualifiedAccess.kt similarity index 85% rename from idea/testData/intentions/simplifyAssertNotNull/qualifiedAccess.kt rename to idea/testData/inspectionsLocal/simplifyAssertNotNull/qualifiedAccess.kt index 5c4c1f00b6e..f881445323b 100644 --- a/idea/testData/intentions/simplifyAssertNotNull/qualifiedAccess.kt +++ b/idea/testData/inspectionsLocal/simplifyAssertNotNull/qualifiedAccess.kt @@ -1,4 +1,4 @@ -// IS_APPLICABLE: false +// PROBLEM: none // WITH_RUNTIME class C(val v: String?) { diff --git a/idea/testData/intentions/simplifyAssertNotNull/withMessage.kt b/idea/testData/inspectionsLocal/simplifyAssertNotNull/withMessage.kt similarity index 70% rename from idea/testData/intentions/simplifyAssertNotNull/withMessage.kt rename to idea/testData/inspectionsLocal/simplifyAssertNotNull/withMessage.kt index af6bca3cf26..92812c05344 100644 --- a/idea/testData/intentions/simplifyAssertNotNull/withMessage.kt +++ b/idea/testData/inspectionsLocal/simplifyAssertNotNull/withMessage.kt @@ -1,4 +1,4 @@ -// INTENTION_TEXT: "Replace with '?: error(...)'" +// FIX: "Replace with '?: error(...)'" // WITH_RUNTIME fun foo(p: Array) { diff --git a/idea/testData/intentions/simplifyAssertNotNull/withMessage.kt.after b/idea/testData/inspectionsLocal/simplifyAssertNotNull/withMessage.kt.after similarity index 67% rename from idea/testData/intentions/simplifyAssertNotNull/withMessage.kt.after rename to idea/testData/inspectionsLocal/simplifyAssertNotNull/withMessage.kt.after index 0a6eca3fc23..1783b7ca1e4 100644 --- a/idea/testData/intentions/simplifyAssertNotNull/withMessage.kt.after +++ b/idea/testData/inspectionsLocal/simplifyAssertNotNull/withMessage.kt.after @@ -1,4 +1,4 @@ -// INTENTION_TEXT: "Replace with '?: error(...)'" +// FIX: "Replace with '?: error(...)'" // WITH_RUNTIME fun foo(p: Array) { diff --git a/idea/testData/intentions/simplifyAssertNotNull/withMessageLambdaOutside.kt b/idea/testData/inspectionsLocal/simplifyAssertNotNull/withMessageLambdaOutside.kt similarity index 70% rename from idea/testData/intentions/simplifyAssertNotNull/withMessageLambdaOutside.kt rename to idea/testData/inspectionsLocal/simplifyAssertNotNull/withMessageLambdaOutside.kt index 01040ce59c6..7f28b496c0e 100644 --- a/idea/testData/intentions/simplifyAssertNotNull/withMessageLambdaOutside.kt +++ b/idea/testData/inspectionsLocal/simplifyAssertNotNull/withMessageLambdaOutside.kt @@ -1,4 +1,4 @@ -// INTENTION_TEXT: "Replace with '?: error(...)'" +// FIX: "Replace with '?: error(...)'" // WITH_RUNTIME fun foo(p: Array) { diff --git a/idea/testData/intentions/simplifyAssertNotNull/withMessageLambdaOutside.kt.after b/idea/testData/inspectionsLocal/simplifyAssertNotNull/withMessageLambdaOutside.kt.after similarity index 67% rename from idea/testData/intentions/simplifyAssertNotNull/withMessageLambdaOutside.kt.after rename to idea/testData/inspectionsLocal/simplifyAssertNotNull/withMessageLambdaOutside.kt.after index 0a6eca3fc23..1783b7ca1e4 100644 --- a/idea/testData/intentions/simplifyAssertNotNull/withMessageLambdaOutside.kt.after +++ b/idea/testData/inspectionsLocal/simplifyAssertNotNull/withMessageLambdaOutside.kt.after @@ -1,4 +1,4 @@ -// INTENTION_TEXT: "Replace with '?: error(...)'" +// FIX: "Replace with '?: error(...)'" // WITH_RUNTIME fun foo(p: Array) { diff --git a/idea/testData/intentions/simplifyAssertNotNull/.intention b/idea/testData/intentions/simplifyAssertNotNull/.intention deleted file mode 100644 index 06bd9d61394..00000000000 --- a/idea/testData/intentions/simplifyAssertNotNull/.intention +++ /dev/null @@ -1 +0,0 @@ -org.jetbrains.kotlin.idea.intentions.SimplifyAssertNotNullIntention diff --git a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java index 3ea40846d6d..90b424c59f3 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java @@ -3516,6 +3516,81 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest { } } + @TestMetadata("idea/testData/inspectionsLocal/simplifyAssertNotNull") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class SimplifyAssertNotNull extends AbstractLocalInspectionTest { + public void testAllFilesPresentInSimplifyAssertNotNull() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/inspectionsLocal/simplifyAssertNotNull"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); + } + + @TestMetadata("comments.kt") + public void testComments() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/simplifyAssertNotNull/comments.kt"); + doTest(fileName); + } + + @TestMetadata("commentsNoMessage.kt") + public void testCommentsNoMessage() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/simplifyAssertNotNull/commentsNoMessage.kt"); + doTest(fileName); + } + + @TestMetadata("complicatedMessageLambda.kt") + public void testComplicatedMessageLambda() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/simplifyAssertNotNull/complicatedMessageLambda.kt"); + doTest(fileName); + } + + @TestMetadata("eqNull.kt") + public void testEqNull() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/simplifyAssertNotNull/eqNull.kt"); + doTest(fileName); + } + + @TestMetadata("errorFunctionInContext.kt") + public void testErrorFunctionInContext() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/simplifyAssertNotNull/errorFunctionInContext.kt"); + doTest(fileName); + } + + @TestMetadata("falseAssert.kt") + public void testFalseAssert() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/simplifyAssertNotNull/falseAssert.kt"); + doTest(fileName); + } + + @TestMetadata("noMessage.kt") + public void testNoMessage() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/simplifyAssertNotNull/noMessage.kt"); + doTest(fileName); + } + + @TestMetadata("otherVariable.kt") + public void testOtherVariable() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/simplifyAssertNotNull/otherVariable.kt"); + doTest(fileName); + } + + @TestMetadata("qualifiedAccess.kt") + public void testQualifiedAccess() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/simplifyAssertNotNull/qualifiedAccess.kt"); + doTest(fileName); + } + + @TestMetadata("withMessage.kt") + public void testWithMessage() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/simplifyAssertNotNull/withMessage.kt"); + doTest(fileName); + } + + @TestMetadata("withMessageLambdaOutside.kt") + public void testWithMessageLambdaOutside() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/simplifyAssertNotNull/withMessageLambdaOutside.kt"); + doTest(fileName); + } + } + @TestMetadata("idea/testData/inspectionsLocal/simplifyNegatedBinaryExpression") @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 9ebd7066555..552ea1a1055 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java @@ -14187,81 +14187,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest { } } - @TestMetadata("idea/testData/intentions/simplifyAssertNotNull") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class SimplifyAssertNotNull extends AbstractIntentionTest { - public void testAllFilesPresentInSimplifyAssertNotNull() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/simplifyAssertNotNull"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true); - } - - @TestMetadata("comments.kt") - public void testComments() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/simplifyAssertNotNull/comments.kt"); - doTest(fileName); - } - - @TestMetadata("commentsNoMessage.kt") - public void testCommentsNoMessage() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/simplifyAssertNotNull/commentsNoMessage.kt"); - doTest(fileName); - } - - @TestMetadata("complicatedMessageLambda.kt") - public void testComplicatedMessageLambda() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/simplifyAssertNotNull/complicatedMessageLambda.kt"); - doTest(fileName); - } - - @TestMetadata("eqNull.kt") - public void testEqNull() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/simplifyAssertNotNull/eqNull.kt"); - doTest(fileName); - } - - @TestMetadata("errorFunctionInContext.kt") - public void testErrorFunctionInContext() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/simplifyAssertNotNull/errorFunctionInContext.kt"); - doTest(fileName); - } - - @TestMetadata("falseAssert.kt") - public void testFalseAssert() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/simplifyAssertNotNull/falseAssert.kt"); - doTest(fileName); - } - - @TestMetadata("noMessage.kt") - public void testNoMessage() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/simplifyAssertNotNull/noMessage.kt"); - doTest(fileName); - } - - @TestMetadata("otherVariable.kt") - public void testOtherVariable() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/simplifyAssertNotNull/otherVariable.kt"); - doTest(fileName); - } - - @TestMetadata("qualifiedAccess.kt") - public void testQualifiedAccess() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/simplifyAssertNotNull/qualifiedAccess.kt"); - doTest(fileName); - } - - @TestMetadata("withMessage.kt") - public void testWithMessage() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/simplifyAssertNotNull/withMessage.kt"); - doTest(fileName); - } - - @TestMetadata("withMessageLambdaOutside.kt") - public void testWithMessageLambdaOutside() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/simplifyAssertNotNull/withMessageLambdaOutside.kt"); - doTest(fileName); - } - } - @TestMetadata("idea/testData/intentions/simplifyBooleanWithConstants") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)