diff --git a/idea/resources/META-INF/plugin-common.xml b/idea/resources/META-INF/plugin-common.xml
index eda01da96b6..3842152ae22 100644
--- a/idea/resources/META-INF/plugin-common.xml
+++ b/idea/resources/META-INF/plugin-common.xml
@@ -1138,11 +1138,6 @@
Kotlin
-
- org.jetbrains.kotlin.idea.intentions.ConvertIfWithThrowToAssertIntention
- Kotlin
-
-
org.jetbrains.kotlin.idea.intentions.SpecifyExplicitLambdaSignatureIntention
Kotlin
diff --git a/idea/resources/intentionDescriptions/ConvertIfWithThrowToAssertIntention/after.kt.template b/idea/resources/intentionDescriptions/ConvertIfWithThrowToAssertIntention/after.kt.template
deleted file mode 100644
index bbc48736afa..00000000000
--- a/idea/resources/intentionDescriptions/ConvertIfWithThrowToAssertIntention/after.kt.template
+++ /dev/null
@@ -1,3 +0,0 @@
-fun foo() {
- assert(!true, "text")
-}
\ No newline at end of file
diff --git a/idea/resources/intentionDescriptions/ConvertIfWithThrowToAssertIntention/before.kt.template b/idea/resources/intentionDescriptions/ConvertIfWithThrowToAssertIntention/before.kt.template
deleted file mode 100644
index bc6e26e894d..00000000000
--- a/idea/resources/intentionDescriptions/ConvertIfWithThrowToAssertIntention/before.kt.template
+++ /dev/null
@@ -1,5 +0,0 @@
-fun foo() {
- if (true) {
- throw AssertionError("text")
- }
-}
\ No newline at end of file
diff --git a/idea/resources/intentionDescriptions/ConvertIfWithThrowToAssertIntention/description.html b/idea/resources/intentionDescriptions/ConvertIfWithThrowToAssertIntention/description.html
deleted file mode 100644
index e0d6e1fcfaf..00000000000
--- a/idea/resources/intentionDescriptions/ConvertIfWithThrowToAssertIntention/description.html
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-This intention converts an if statement that throws an AssertionError exception into an assertion.
-
-
\ No newline at end of file
diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertIfWithThrowToAssertIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertIfWithThrowToAssertIntention.kt
deleted file mode 100644
index d149633991b..00000000000
--- a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertIfWithThrowToAssertIntention.kt
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.
- */
-
-package org.jetbrains.kotlin.idea.intentions
-
-import com.intellij.openapi.editor.Editor
-import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall
-import org.jetbrains.kotlin.idea.core.ShortenReferences
-import org.jetbrains.kotlin.idea.core.replaced
-import org.jetbrains.kotlin.idea.inspections.SimplifyNegatedBinaryExpressionInspection
-import org.jetbrains.kotlin.idea.intentions.branchedTransformations.isNullExpression
-import org.jetbrains.kotlin.idea.intentions.branchedTransformations.unwrapBlockOrParenthesis
-import org.jetbrains.kotlin.psi.*
-import org.jetbrains.kotlin.resolve.DescriptorUtils
-import org.jetbrains.kotlin.utils.addToStdlib.constant
-
-class ConvertIfWithThrowToAssertIntention : SelfTargetingOffsetIndependentIntention(KtIfExpression::class.java, "Replace 'if' with 'assert' statement") {
- override fun isApplicableTo(element: KtIfExpression): Boolean {
- if (element.`else` != null) return false
-
- val throwExpr = element.then?.unwrapBlockOrParenthesis() as? KtThrowExpression
- val thrownExpr = getSelector(throwExpr?.thrownExpression)
- if (thrownExpr !is KtCallExpression) return false
-
- if (thrownExpr.valueArguments.size > 1) return false
-
- val resolvedCall = thrownExpr.resolveToCall() ?: return false
- val targetFqName = DescriptorUtils.getFqName(resolvedCall.resultingDescriptor).asString()
- return targetFqName in constant { setOf("kotlin.AssertionError.", "java.lang.AssertionError.") }
- }
-
- override fun applyTo(element: KtIfExpression, editor: Editor?) {
- val condition = element.condition ?: return
-
- val thenExpr = element.then?.unwrapBlockOrParenthesis() as KtThrowExpression
- val thrownExpr = getSelector(thenExpr.thrownExpression) as KtCallExpression
-
- val psiFactory = KtPsiFactory(element)
- condition.replace(psiFactory.createExpressionByPattern("!$0", condition))
-
- var newCondition = element.condition!!
- val simplifier = SimplifyNegatedBinaryExpressionInspection()
- if (simplifier.isApplicable(newCondition as KtPrefixExpression)) {
- simplifier.applyTo(newCondition.operationReference, editor = editor)
- newCondition = element.condition!!
- }
-
- val arg = thrownExpr.valueArguments.singleOrNull()?.getArgumentExpression()
- val assertExpr = if (arg != null && !arg.isNullExpression())
- psiFactory.createExpressionByPattern("kotlin.assert($0) {$1}", newCondition, arg)
- else
- psiFactory.createExpressionByPattern("kotlin.assert($0)", newCondition)
-
- val newExpr = element.replaced(assertExpr)
- ShortenReferences.DEFAULT.process(newExpr)
- }
-
- private fun getSelector(element: KtExpression?): KtExpression? {
- if (element is KtDotQualifiedExpression) {
- return element.selectorExpression
- }
- return element
- }
-}
diff --git a/idea/testData/intentions/convertIfWithThrowToAssert/.intention b/idea/testData/intentions/convertIfWithThrowToAssert/.intention
deleted file mode 100644
index 281d18eb471..00000000000
--- a/idea/testData/intentions/convertIfWithThrowToAssert/.intention
+++ /dev/null
@@ -1 +0,0 @@
-org.jetbrains.kotlin.idea.intentions.ConvertIfWithThrowToAssertIntention
diff --git a/idea/testData/intentions/convertIfWithThrowToAssert/assertOverloaded.kt b/idea/testData/intentions/convertIfWithThrowToAssert/assertOverloaded.kt
deleted file mode 100644
index 96b46d262ac..00000000000
--- a/idea/testData/intentions/convertIfWithThrowToAssert/assertOverloaded.kt
+++ /dev/null
@@ -1,8 +0,0 @@
-// WITH_RUNTIME
-fun foo() {
- if (true) {
- throw AssertionError("text")
- }
-}
-
-fun assert(x: Boolean, y: Any) {}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertIfWithThrowToAssert/assertOverloaded.kt.after b/idea/testData/intentions/convertIfWithThrowToAssert/assertOverloaded.kt.after
deleted file mode 100644
index 1bc45cdd6e9..00000000000
--- a/idea/testData/intentions/convertIfWithThrowToAssert/assertOverloaded.kt.after
+++ /dev/null
@@ -1,6 +0,0 @@
-// WITH_RUNTIME
-fun foo() {
- kotlin.assert(!true) { "text" }
-}
-
-fun assert(x: Boolean, y: Any) {}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertIfWithThrowToAssert/assertOverloaded2.kt b/idea/testData/intentions/convertIfWithThrowToAssert/assertOverloaded2.kt
deleted file mode 100644
index 43ca6e251e6..00000000000
--- a/idea/testData/intentions/convertIfWithThrowToAssert/assertOverloaded2.kt
+++ /dev/null
@@ -1,10 +0,0 @@
-// WITH_RUNTIME
-package foo.kotlin
-
-fun foo() {
- if (true) {
- throw AssertionError("text")
- }
-}
-
-fun assert(x: Boolean, y: Any) {}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertIfWithThrowToAssert/assertOverloaded2.kt.after b/idea/testData/intentions/convertIfWithThrowToAssert/assertOverloaded2.kt.after
deleted file mode 100644
index c07313361e0..00000000000
--- a/idea/testData/intentions/convertIfWithThrowToAssert/assertOverloaded2.kt.after
+++ /dev/null
@@ -1,8 +0,0 @@
-// WITH_RUNTIME
-package foo.kotlin
-
-fun foo() {
- kotlin.assert(!true) { "text" }
-}
-
-fun assert(x: Boolean, y: Any) {}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertIfWithThrowToAssert/booleanCondition.kt b/idea/testData/intentions/convertIfWithThrowToAssert/booleanCondition.kt
deleted file mode 100644
index 42128a65196..00000000000
--- a/idea/testData/intentions/convertIfWithThrowToAssert/booleanCondition.kt
+++ /dev/null
@@ -1,7 +0,0 @@
-// WITH_RUNTIME
-fun foo() {
- val x = true
- if (x && false) {
- throw AssertionError("text")
- }
-}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertIfWithThrowToAssert/booleanCondition.kt.after b/idea/testData/intentions/convertIfWithThrowToAssert/booleanCondition.kt.after
deleted file mode 100644
index 83d417230ac..00000000000
--- a/idea/testData/intentions/convertIfWithThrowToAssert/booleanCondition.kt.after
+++ /dev/null
@@ -1,5 +0,0 @@
-// WITH_RUNTIME
-fun foo() {
- val x = true
- assert(!(x && false)) { "text" }
-}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertIfWithThrowToAssert/dotQualifiedThrow.kt b/idea/testData/intentions/convertIfWithThrowToAssert/dotQualifiedThrow.kt
deleted file mode 100644
index 9a5f57d5ef2..00000000000
--- a/idea/testData/intentions/convertIfWithThrowToAssert/dotQualifiedThrow.kt
+++ /dev/null
@@ -1,6 +0,0 @@
-// WITH_RUNTIME
-fun foo() {
- if (true) {
- throw java.lang.AssertionError("text")
- }
-}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertIfWithThrowToAssert/dotQualifiedThrow.kt.after b/idea/testData/intentions/convertIfWithThrowToAssert/dotQualifiedThrow.kt.after
deleted file mode 100644
index 14c16339aca..00000000000
--- a/idea/testData/intentions/convertIfWithThrowToAssert/dotQualifiedThrow.kt.after
+++ /dev/null
@@ -1,4 +0,0 @@
-// WITH_RUNTIME
-fun foo() {
- assert(!true) { "text" }
-}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertIfWithThrowToAssert/inapplicableAssertionErrorOverloaded.kt b/idea/testData/intentions/convertIfWithThrowToAssert/inapplicableAssertionErrorOverloaded.kt
deleted file mode 100644
index 641dc0fdcad..00000000000
--- a/idea/testData/intentions/convertIfWithThrowToAssert/inapplicableAssertionErrorOverloaded.kt
+++ /dev/null
@@ -1,9 +0,0 @@
-// IS_APPLICABLE: false
-// WITH_RUNTIME
-fun foo() {
- if (1 == 0) {
- throw AssertionError("text")
- }
-}
-
-class AssertionError(x: String): Exception(x) {}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertIfWithThrowToAssert/inapplicableCauseSent.kt b/idea/testData/intentions/convertIfWithThrowToAssert/inapplicableCauseSent.kt
deleted file mode 100644
index f3bd8ba78ee..00000000000
--- a/idea/testData/intentions/convertIfWithThrowToAssert/inapplicableCauseSent.kt
+++ /dev/null
@@ -1,8 +0,0 @@
-// IS_APPLICABLE: false
-// WITH_RUNTIME
-// MIN_JAVA_VERSION: 1.7
-fun foo() {
- if (1 == 0) {
- throw AssertionError("text", Exception())
- }
-}
diff --git a/idea/testData/intentions/convertIfWithThrowToAssert/inapplicableHasElse.kt b/idea/testData/intentions/convertIfWithThrowToAssert/inapplicableHasElse.kt
deleted file mode 100644
index 9709dffc68e..00000000000
--- a/idea/testData/intentions/convertIfWithThrowToAssert/inapplicableHasElse.kt
+++ /dev/null
@@ -1,9 +0,0 @@
-// IS_APPLICABLE: false
-// WITH_RUNTIME
-fun foo() {
- if (1 == 0) {
- throw AssertionError("text")
- } else {
- val x = 1
- }
-}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertIfWithThrowToAssert/inapplicableMoreThanSingleExpression.kt b/idea/testData/intentions/convertIfWithThrowToAssert/inapplicableMoreThanSingleExpression.kt
deleted file mode 100644
index 85a21a75fcb..00000000000
--- a/idea/testData/intentions/convertIfWithThrowToAssert/inapplicableMoreThanSingleExpression.kt
+++ /dev/null
@@ -1,8 +0,0 @@
-// IS_APPLICABLE: false
-// WITH_RUNTIME
-fun foo() {
- if (1 == 0) {
- val y = 1
- throw AssertionError("text")
- }
-}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertIfWithThrowToAssert/inapplicableMoreThanSingleExpression2.kt b/idea/testData/intentions/convertIfWithThrowToAssert/inapplicableMoreThanSingleExpression2.kt
deleted file mode 100644
index 9a9f8ca0aac..00000000000
--- a/idea/testData/intentions/convertIfWithThrowToAssert/inapplicableMoreThanSingleExpression2.kt
+++ /dev/null
@@ -1,8 +0,0 @@
-// IS_APPLICABLE: false
-// WITH_RUNTIME
-fun foo() {
- if (1 == 0) {
- throw AssertionError("text")
- val y = 1
- }
-}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertIfWithThrowToAssert/noMessageSent.kt b/idea/testData/intentions/convertIfWithThrowToAssert/noMessageSent.kt
deleted file mode 100644
index ca41f261d9a..00000000000
--- a/idea/testData/intentions/convertIfWithThrowToAssert/noMessageSent.kt
+++ /dev/null
@@ -1,6 +0,0 @@
-// WITH_RUNTIME
-fun foo() {
- if (true) {
- throw AssertionError()
- }
-}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertIfWithThrowToAssert/noMessageSent.kt.after b/idea/testData/intentions/convertIfWithThrowToAssert/noMessageSent.kt.after
deleted file mode 100644
index d656eeba018..00000000000
--- a/idea/testData/intentions/convertIfWithThrowToAssert/noMessageSent.kt.after
+++ /dev/null
@@ -1,4 +0,0 @@
-// WITH_RUNTIME
-fun foo() {
- assert(!true)
-}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertIfWithThrowToAssert/nullSent.kt b/idea/testData/intentions/convertIfWithThrowToAssert/nullSent.kt
deleted file mode 100644
index aded6800c65..00000000000
--- a/idea/testData/intentions/convertIfWithThrowToAssert/nullSent.kt
+++ /dev/null
@@ -1,6 +0,0 @@
-// WITH_RUNTIME
-fun foo() {
- if (true) {
- throw AssertionError(null)
- }
-}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertIfWithThrowToAssert/nullSent.kt.after b/idea/testData/intentions/convertIfWithThrowToAssert/nullSent.kt.after
deleted file mode 100644
index d656eeba018..00000000000
--- a/idea/testData/intentions/convertIfWithThrowToAssert/nullSent.kt.after
+++ /dev/null
@@ -1,4 +0,0 @@
-// WITH_RUNTIME
-fun foo() {
- assert(!true)
-}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertIfWithThrowToAssert/simpleConvert.kt b/idea/testData/intentions/convertIfWithThrowToAssert/simpleConvert.kt
deleted file mode 100644
index 1d50a58d487..00000000000
--- a/idea/testData/intentions/convertIfWithThrowToAssert/simpleConvert.kt
+++ /dev/null
@@ -1,6 +0,0 @@
-// WITH_RUNTIME
-fun foo() {
- if (true) {
- throw AssertionError("text")
- }
-}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertIfWithThrowToAssert/simpleConvert.kt.after b/idea/testData/intentions/convertIfWithThrowToAssert/simpleConvert.kt.after
deleted file mode 100644
index 14c16339aca..00000000000
--- a/idea/testData/intentions/convertIfWithThrowToAssert/simpleConvert.kt.after
+++ /dev/null
@@ -1,4 +0,0 @@
-// WITH_RUNTIME
-fun foo() {
- assert(!true) { "text" }
-}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertIfWithThrowToAssert/simplifiedCondition.kt b/idea/testData/intentions/convertIfWithThrowToAssert/simplifiedCondition.kt
deleted file mode 100644
index 9bac11aff09..00000000000
--- a/idea/testData/intentions/convertIfWithThrowToAssert/simplifiedCondition.kt
+++ /dev/null
@@ -1,6 +0,0 @@
-// WITH_RUNTIME
-fun foo() {
- if (1 == 0) {
- throw AssertionError("text")
- }
-}
\ No newline at end of file
diff --git a/idea/testData/intentions/convertIfWithThrowToAssert/simplifiedCondition.kt.after b/idea/testData/intentions/convertIfWithThrowToAssert/simplifiedCondition.kt.after
deleted file mode 100644
index 8dc94444b77..00000000000
--- a/idea/testData/intentions/convertIfWithThrowToAssert/simplifiedCondition.kt.after
+++ /dev/null
@@ -1,4 +0,0 @@
-// WITH_RUNTIME
-fun foo() {
- assert(1 != 0) { "text" }
-}
\ No newline at end of file
diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java
index 4485d647129..4a528d7e490 100644
--- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java
+++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java
@@ -5328,84 +5328,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
}
}
- @TestMetadata("idea/testData/intentions/convertIfWithThrowToAssert")
- @TestDataPath("$PROJECT_ROOT")
- @RunWith(JUnit3RunnerWithInners.class)
- public static class ConvertIfWithThrowToAssert extends AbstractIntentionTest {
- private void runTest(String testDataFilePath) throws Exception {
- KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
- }
-
- public void testAllFilesPresentInConvertIfWithThrowToAssert() throws Exception {
- KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/convertIfWithThrowToAssert"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
- }
-
- @TestMetadata("assertOverloaded.kt")
- public void testAssertOverloaded() throws Exception {
- runTest("idea/testData/intentions/convertIfWithThrowToAssert/assertOverloaded.kt");
- }
-
- @TestMetadata("assertOverloaded2.kt")
- public void testAssertOverloaded2() throws Exception {
- runTest("idea/testData/intentions/convertIfWithThrowToAssert/assertOverloaded2.kt");
- }
-
- @TestMetadata("booleanCondition.kt")
- public void testBooleanCondition() throws Exception {
- runTest("idea/testData/intentions/convertIfWithThrowToAssert/booleanCondition.kt");
- }
-
- @TestMetadata("dotQualifiedThrow.kt")
- public void testDotQualifiedThrow() throws Exception {
- runTest("idea/testData/intentions/convertIfWithThrowToAssert/dotQualifiedThrow.kt");
- }
-
- @TestMetadata("inapplicableAssertionErrorOverloaded.kt")
- public void testInapplicableAssertionErrorOverloaded() throws Exception {
- runTest("idea/testData/intentions/convertIfWithThrowToAssert/inapplicableAssertionErrorOverloaded.kt");
- }
-
- @TestMetadata("inapplicableCauseSent.kt")
- public void testInapplicableCauseSent() throws Exception {
- runTest("idea/testData/intentions/convertIfWithThrowToAssert/inapplicableCauseSent.kt");
- }
-
- @TestMetadata("inapplicableHasElse.kt")
- public void testInapplicableHasElse() throws Exception {
- runTest("idea/testData/intentions/convertIfWithThrowToAssert/inapplicableHasElse.kt");
- }
-
- @TestMetadata("inapplicableMoreThanSingleExpression.kt")
- public void testInapplicableMoreThanSingleExpression() throws Exception {
- runTest("idea/testData/intentions/convertIfWithThrowToAssert/inapplicableMoreThanSingleExpression.kt");
- }
-
- @TestMetadata("inapplicableMoreThanSingleExpression2.kt")
- public void testInapplicableMoreThanSingleExpression2() throws Exception {
- runTest("idea/testData/intentions/convertIfWithThrowToAssert/inapplicableMoreThanSingleExpression2.kt");
- }
-
- @TestMetadata("noMessageSent.kt")
- public void testNoMessageSent() throws Exception {
- runTest("idea/testData/intentions/convertIfWithThrowToAssert/noMessageSent.kt");
- }
-
- @TestMetadata("nullSent.kt")
- public void testNullSent() throws Exception {
- runTest("idea/testData/intentions/convertIfWithThrowToAssert/nullSent.kt");
- }
-
- @TestMetadata("simpleConvert.kt")
- public void testSimpleConvert() throws Exception {
- runTest("idea/testData/intentions/convertIfWithThrowToAssert/simpleConvert.kt");
- }
-
- @TestMetadata("simplifiedCondition.kt")
- public void testSimplifiedCondition() throws Exception {
- runTest("idea/testData/intentions/convertIfWithThrowToAssert/simplifiedCondition.kt");
- }
- }
-
@TestMetadata("idea/testData/intentions/convertLambdaToReference")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)