diff --git a/idea/resources/inspectionDescriptions/ReplaceSizeCheckWithIsNotEmpty.html b/idea/resources/inspectionDescriptions/ReplaceSizeCheckWithIsNotEmpty.html
new file mode 100644
index 00000000000..dd47a1db676
--- /dev/null
+++ b/idea/resources/inspectionDescriptions/ReplaceSizeCheckWithIsNotEmpty.html
@@ -0,0 +1,5 @@
+
+
+This inspection detects size checks of Collections/Array/String that should be replaced with 'isNotEmpty()'
+
+
diff --git a/idea/resources/inspectionDescriptions/ReplaceSizeZeroCheckWithIsEmpty.html b/idea/resources/inspectionDescriptions/ReplaceSizeZeroCheckWithIsEmpty.html
new file mode 100644
index 00000000000..2111568f43f
--- /dev/null
+++ b/idea/resources/inspectionDescriptions/ReplaceSizeZeroCheckWithIsEmpty.html
@@ -0,0 +1,5 @@
+
+
+This inspection detects size zero checks of Collections/Array/String that should be replaced with 'isEmpty()'
+
+
diff --git a/idea/resources/intentionDescriptions/ReplaceSizeCheckWithIsNotEmptyIntention/after.kt.template b/idea/resources/intentionDescriptions/ReplaceSizeCheckWithIsNotEmptyIntention/after.kt.template
new file mode 100644
index 00000000000..781805a7389
--- /dev/null
+++ b/idea/resources/intentionDescriptions/ReplaceSizeCheckWithIsNotEmptyIntention/after.kt.template
@@ -0,0 +1 @@
+list.isNotEmpty()
\ No newline at end of file
diff --git a/idea/resources/intentionDescriptions/ReplaceSizeCheckWithIsNotEmptyIntention/before.kt.template b/idea/resources/intentionDescriptions/ReplaceSizeCheckWithIsNotEmptyIntention/before.kt.template
new file mode 100644
index 00000000000..ce26222b467
--- /dev/null
+++ b/idea/resources/intentionDescriptions/ReplaceSizeCheckWithIsNotEmptyIntention/before.kt.template
@@ -0,0 +1 @@
+list.size > 0
diff --git a/idea/resources/intentionDescriptions/ReplaceSizeCheckWithIsNotEmptyIntention/description.html b/idea/resources/intentionDescriptions/ReplaceSizeCheckWithIsNotEmptyIntention/description.html
new file mode 100644
index 00000000000..c323beed44e
--- /dev/null
+++ b/idea/resources/intentionDescriptions/ReplaceSizeCheckWithIsNotEmptyIntention/description.html
@@ -0,0 +1,5 @@
+
+
+This intention replaces size check with 'isNotEmpty()'
+
+
diff --git a/idea/resources/intentionDescriptions/ReplaceSizeZeroCheckWithIsEmptyIntention/after.kt.template b/idea/resources/intentionDescriptions/ReplaceSizeZeroCheckWithIsEmptyIntention/after.kt.template
new file mode 100644
index 00000000000..aa6bfde448c
--- /dev/null
+++ b/idea/resources/intentionDescriptions/ReplaceSizeZeroCheckWithIsEmptyIntention/after.kt.template
@@ -0,0 +1 @@
+list.isEmpty()
\ No newline at end of file
diff --git a/idea/resources/intentionDescriptions/ReplaceSizeZeroCheckWithIsEmptyIntention/before.kt.template b/idea/resources/intentionDescriptions/ReplaceSizeZeroCheckWithIsEmptyIntention/before.kt.template
new file mode 100644
index 00000000000..2872beeba37
--- /dev/null
+++ b/idea/resources/intentionDescriptions/ReplaceSizeZeroCheckWithIsEmptyIntention/before.kt.template
@@ -0,0 +1 @@
+list.size == 0
diff --git a/idea/resources/intentionDescriptions/ReplaceSizeZeroCheckWithIsEmptyIntention/description.html b/idea/resources/intentionDescriptions/ReplaceSizeZeroCheckWithIsEmptyIntention/description.html
new file mode 100644
index 00000000000..1f488a413a3
--- /dev/null
+++ b/idea/resources/intentionDescriptions/ReplaceSizeZeroCheckWithIsEmptyIntention/description.html
@@ -0,0 +1,5 @@
+
+
+This intention replaces size 0 check with 'isEmpty()'
+
+
diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml
index 75490f4b8de..7bbaced9786 100644
--- a/idea/src/META-INF/plugin.xml
+++ b/idea/src/META-INF/plugin.xml
@@ -1375,6 +1375,16 @@
Kotlin
+
+ org.jetbrains.kotlin.idea.intentions.ReplaceSizeCheckWithIsNotEmptyIntention
+ Kotlin
+
+
+
+ org.jetbrains.kotlin.idea.intentions.ReplaceSizeZeroCheckWithIsEmptyIntention
+ Kotlin
+
+
+
+
+
+
diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceSizeCheckIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceSizeCheckIntention.kt
new file mode 100644
index 00000000000..250ec8d750f
--- /dev/null
+++ b/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceSizeCheckIntention.kt
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2010-2016 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.core.replaced
+import org.jetbrains.kotlin.psi.KtBinaryExpression
+import org.jetbrains.kotlin.psi.KtDotQualifiedExpression
+import org.jetbrains.kotlin.psi.KtExpression
+import org.jetbrains.kotlin.psi.KtPsiFactory
+
+abstract class ReplaceSizeCheckIntention(text: String) : SelfTargetingOffsetIndependentIntention(
+ KtBinaryExpression::class.java, text) {
+
+ override fun applyTo(element: KtBinaryExpression, editor: Editor?) {
+ val target = getTargetExpression(element)
+ if (target !is KtDotQualifiedExpression) return
+ val createExpression = KtPsiFactory(element).createExpression("${target.receiverExpression.text}.${getGenerateMethodSymbol()}")
+ element.replaced(createExpression)
+ }
+
+ override fun isApplicableTo(element: KtBinaryExpression): Boolean {
+ val targetExpression = getTargetExpression(element) ?: return false
+ return targetExpression.isSizeOrLength()
+ }
+
+ abstract fun getTargetExpression(element: KtBinaryExpression): KtExpression?
+
+ abstract fun getGenerateMethodSymbol(): String
+}
\ No newline at end of file
diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceSizeCheckWithIsNotEmptyIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceSizeCheckWithIsNotEmptyIntention.kt
new file mode 100644
index 00000000000..0f0e40edd53
--- /dev/null
+++ b/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceSizeCheckWithIsNotEmptyIntention.kt
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2010-2016 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 org.jetbrains.kotlin.idea.inspections.IntentionBasedInspection
+import org.jetbrains.kotlin.lexer.KtTokens
+import org.jetbrains.kotlin.psi.KtBinaryExpression
+import org.jetbrains.kotlin.psi.KtExpression
+
+class ReplaceSizeCheckWithIsNotEmptyInspection : IntentionBasedInspection(ReplaceSizeCheckWithIsNotEmptyIntention::class)
+
+class ReplaceSizeCheckWithIsNotEmptyIntention : ReplaceSizeCheckIntention("Replace size check with 'isNotEmpty'") {
+
+ override fun getGenerateMethodSymbol() = "isNotEmpty()"
+
+ override fun getTargetExpression(element: KtBinaryExpression): KtExpression? {
+ return when (element.operationToken) {
+ KtTokens.EXCLEQ -> when {
+ element.right.isZero() -> element.left
+ element.left.isZero() -> element.right
+ else -> null
+ }
+ KtTokens.GT -> if (element.right.isZero()) element.left else null
+ KtTokens.LT -> if (element.left.isZero()) element.right else null
+ KtTokens.GTEQ -> if (element.right.isOne()) element.left else null
+ KtTokens.LTEQ -> if (element.left.isOne()) element.right else null
+ else -> null
+ }
+ }
+}
\ No newline at end of file
diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceSizeZeroCheckWithIsEmptyIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceSizeZeroCheckWithIsEmptyIntention.kt
new file mode 100644
index 00000000000..bdbbf03e219
--- /dev/null
+++ b/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceSizeZeroCheckWithIsEmptyIntention.kt
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2010-2016 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 org.jetbrains.kotlin.idea.inspections.IntentionBasedInspection
+import org.jetbrains.kotlin.lexer.KtTokens
+import org.jetbrains.kotlin.psi.KtBinaryExpression
+import org.jetbrains.kotlin.psi.KtExpression
+
+class ReplaceSizeZeroCheckWithIsEmptyInspection : IntentionBasedInspection(ReplaceSizeZeroCheckWithIsEmptyIntention::class)
+
+class ReplaceSizeZeroCheckWithIsEmptyIntention : ReplaceSizeCheckIntention("Replace size zero check with 'isEmpty'") {
+
+ override fun getGenerateMethodSymbol() = "isEmpty()"
+
+ override fun getTargetExpression(element: KtBinaryExpression): KtExpression? {
+ return when (element.operationToken) {
+ KtTokens.EQEQ -> when {
+ element.right.isZero() -> element.left
+ element.left.isZero() -> element.right
+ else -> null
+ }
+ KtTokens.GT -> if (element.left.isOne()) element.right else null
+ KtTokens.LT -> if (element.right.isOne()) element.left else null
+ KtTokens.GTEQ -> if (element.left.isZero()) element.right else null
+ KtTokens.LTEQ -> if (element.right.isZero()) element.left else null
+ else -> null
+ }
+ }
+}
\ No newline at end of file
diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/Utils.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/Utils.kt
index d00332c1b9b..ccb3cf06402 100644
--- a/idea/src/org/jetbrains/kotlin/idea/intentions/Utils.kt
+++ b/idea/src/org/jetbrains/kotlin/idea/intentions/Utils.kt
@@ -26,7 +26,9 @@ import org.jetbrains.kotlin.idea.caches.resolve.analyzeAndGetResult
import org.jetbrains.kotlin.idea.core.ShortenReferences
import org.jetbrains.kotlin.idea.references.mainReference
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers
+import org.jetbrains.kotlin.js.descriptorUtils.nameIfStandardType
import org.jetbrains.kotlin.lexer.KtTokens
+import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.typeRefHelpers.setReceiverTypeReference
import org.jetbrains.kotlin.resolve.BindingContext
@@ -233,3 +235,42 @@ private fun KtExpression.ifBranchesOrThis(): List {
return listOf(then) + `else`?.ifBranchesOrThis().orEmpty()
}
+private val arrayName = Name.identifier("Array")
+
+private val collectionName = Name.identifier("Collection")
+
+private val stringName = Name.identifier("String")
+
+fun ResolvedCall.resolvedToArrayType() =
+ resultingDescriptor.returnType?.nameIfStandardType == arrayName
+
+fun ResolvedCall.resolvedToCollectionType() =
+ resultingDescriptor.returnType?.constructor?.supertypes?.firstOrNull {
+ it.nameIfStandardType == collectionName
+ } != null
+
+fun ResolvedCall.resolvedToStringType() =
+ resultingDescriptor.returnType?.nameIfStandardType == stringName
+
+fun KtElement?.isZero() = this?.text == "0"
+
+fun KtElement?.isOne() = this?.text == "1"
+
+fun KtElement?.isSizeOrLength(): Boolean {
+ if (this !is KtDotQualifiedExpression) return false
+ return when (selectorExpression?.text) {
+ "size" -> receiverExpression.isArrayOrCollection()
+ "length" -> receiverExpression.isString()
+ else -> false
+ }
+}
+
+private fun KtExpression.isArrayOrCollection(): Boolean {
+ val resolvedCall = getResolvedCall(analyze()) ?: return false
+ return resolvedCall.resolvedToArrayType() || resolvedCall.resolvedToCollectionType()
+}
+
+private fun KtExpression.isString(): Boolean {
+ val resolvedCall = getResolvedCall(analyze()) ?: return false
+ return resolvedCall.resolvedToStringType()
+}
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/.intention b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/.intention
new file mode 100644
index 00000000000..935c3f42202
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/.intention
@@ -0,0 +1 @@
+org.jetbrains.kotlin.idea.intentions.ReplaceSizeCheckWithIsNotEmptyIntention
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/array.kt b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/array.kt
new file mode 100644
index 00000000000..1ee9b6741d0
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/array.kt
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val arrayOf = arrayOf(1, 2, 3)
+ arrayOf.size > 0
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/array.kt.after b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/array.kt.after
new file mode 100644
index 00000000000..c38808be30c
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/array.kt.after
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val arrayOf = arrayOf(1, 2, 3)
+ arrayOf.isNotEmpty()
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/array2.kt b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/array2.kt
new file mode 100644
index 00000000000..8330fc27f02
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/array2.kt
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val arrayOf = arrayOf(1, 2, 3)
+ 0 < arrayOf.size
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/array2.kt.after b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/array2.kt.after
new file mode 100644
index 00000000000..c38808be30c
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/array2.kt.after
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val arrayOf = arrayOf(1, 2, 3)
+ arrayOf.isNotEmpty()
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/gt.kt b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/gt.kt
new file mode 100644
index 00000000000..5f305cc444e
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/gt.kt
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val listOf = listOf(1, 2, 3)
+ listOf.size > 0
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/gt.kt.after b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/gt.kt.after
new file mode 100644
index 00000000000..b98a28ec976
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/gt.kt.after
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val listOf = listOf(1, 2, 3)
+ listOf.isNotEmpty()
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/gteq.kt b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/gteq.kt
new file mode 100644
index 00000000000..3d1a6a48f78
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/gteq.kt
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val listOf = listOf(1, 2, 3)
+ listOf.size >= 1
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/gteq.kt.after b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/gteq.kt.after
new file mode 100644
index 00000000000..b98a28ec976
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/gteq.kt.after
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val listOf = listOf(1, 2, 3)
+ listOf.isNotEmpty()
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/list.kt b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/list.kt
new file mode 100644
index 00000000000..5f305cc444e
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/list.kt
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val listOf = listOf(1, 2, 3)
+ listOf.size > 0
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/list.kt.after b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/list.kt.after
new file mode 100644
index 00000000000..b98a28ec976
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/list.kt.after
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val listOf = listOf(1, 2, 3)
+ listOf.isNotEmpty()
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/list2.kt b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/list2.kt
new file mode 100644
index 00000000000..3002acc3484
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/list2.kt
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val listOf = listOf(1, 2, 3)
+ 0 < listOf.size
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/list2.kt.after b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/list2.kt.after
new file mode 100644
index 00000000000..b98a28ec976
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/list2.kt.after
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val listOf = listOf(1, 2, 3)
+ listOf.isNotEmpty()
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/lt.kt b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/lt.kt
new file mode 100644
index 00000000000..3002acc3484
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/lt.kt
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val listOf = listOf(1, 2, 3)
+ 0 < listOf.size
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/lt.kt.after b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/lt.kt.after
new file mode 100644
index 00000000000..b98a28ec976
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/lt.kt.after
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val listOf = listOf(1, 2, 3)
+ listOf.isNotEmpty()
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/lteq.kt b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/lteq.kt
new file mode 100644
index 00000000000..78b9a348f86
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/lteq.kt
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val listOf = listOf(1, 2, 3)
+ 1 <= listOf.size
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/lteq.kt.after b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/lteq.kt.after
new file mode 100644
index 00000000000..b98a28ec976
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/lteq.kt.after
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val listOf = listOf(1, 2, 3)
+ listOf.isNotEmpty()
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/oppositeSign.kt b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/oppositeSign.kt
new file mode 100644
index 00000000000..f10338960e6
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/oppositeSign.kt
@@ -0,0 +1,7 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: false
+
+fun foo() {
+ val arrayOf = arrayOf(1, 2, 3)
+ arrayOf.size < 0
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/oppositeSign2.kt b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/oppositeSign2.kt
new file mode 100644
index 00000000000..1c56cfecc73
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/oppositeSign2.kt
@@ -0,0 +1,7 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: false
+
+fun foo() {
+ val arrayOf = arrayOf(1, 2, 3)
+ 0 > arrayOf.size 0
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/set.kt b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/set.kt
new file mode 100644
index 00000000000..c39ebbaeb0f
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/set.kt
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val setOf = setOf(1, 2, 3)
+ setOf.size > 0
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/set.kt.after b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/set.kt.after
new file mode 100644
index 00000000000..fb324270444
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/set.kt.after
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val setOf = setOf(1, 2, 3)
+ setOf.isNotEmpty()
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/sizeCheck.kt b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/sizeCheck.kt
new file mode 100644
index 00000000000..60a420998dd
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/sizeCheck.kt
@@ -0,0 +1,11 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: false
+
+class List {
+ val size = 0
+}
+
+fun foo() {
+ val list = List()
+ list.size > 0
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/string.kt b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/string.kt
new file mode 100644
index 00000000000..4720cc65e2c
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/string.kt
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val text = "123"
+ text.length > 0
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/string.kt.after b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/string.kt.after
new file mode 100644
index 00000000000..eaf3be67379
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/string.kt.after
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val text = "123"
+ text.isNotEmpty()
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/string2.kt b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/string2.kt
new file mode 100644
index 00000000000..41dbd54f199
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/string2.kt
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val text = "123"
+ 0 < text.length
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/string2.kt.after b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/string2.kt.after
new file mode 100644
index 00000000000..eaf3be67379
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/string2.kt.after
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val text = "123"
+ text.isNotEmpty()
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/.intention b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/.intention
new file mode 100644
index 00000000000..6e52d328515
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/.intention
@@ -0,0 +1 @@
+org.jetbrains.kotlin.idea.intentions.ReplaceSizeZeroCheckWithIsEmptyIntention
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/array.kt b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/array.kt
new file mode 100644
index 00000000000..9bba07ab75a
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/array.kt
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val arrayOf = arrayOf(1, 2, 3)
+ arrayOf.size == 0
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/array.kt.after b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/array.kt.after
new file mode 100644
index 00000000000..463cb615e3c
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/array.kt.after
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val arrayOf = arrayOf(1, 2, 3)
+ arrayOf.isEmpty()
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/array2.kt b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/array2.kt
new file mode 100644
index 00000000000..cda1e08b3a8
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/array2.kt
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val arrayOf = arrayOf(1, 2, 3)
+ 0 == arrayOf.size
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/array2.kt.after b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/array2.kt.after
new file mode 100644
index 00000000000..463cb615e3c
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/array2.kt.after
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val arrayOf = arrayOf(1, 2, 3)
+ arrayOf.isEmpty()
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/gt.kt b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/gt.kt
new file mode 100644
index 00000000000..ebf197ca354
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/gt.kt
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val listOf = listOf(1, 2, 3)
+ 1 > listOf.size
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/gt.kt.after b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/gt.kt.after
new file mode 100644
index 00000000000..b5d00e6e2cc
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/gt.kt.after
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val listOf = listOf(1, 2, 3)
+ listOf.isEmpty()
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/gteq.kt b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/gteq.kt
new file mode 100644
index 00000000000..658ce6739f0
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/gteq.kt
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val listOf = listOf(1, 2, 3)
+ 0 >= listOf.size
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/gteq.kt.after b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/gteq.kt.after
new file mode 100644
index 00000000000..b5d00e6e2cc
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/gteq.kt.after
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val listOf = listOf(1, 2, 3)
+ listOf.isEmpty()
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/list.kt b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/list.kt
new file mode 100644
index 00000000000..93afec7f6e7
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/list.kt
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val listOf = listOf(1, 2, 3)
+ listOf.size == 0
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/list.kt.after b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/list.kt.after
new file mode 100644
index 00000000000..b5d00e6e2cc
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/list.kt.after
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val listOf = listOf(1, 2, 3)
+ listOf.isEmpty()
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/list2.kt b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/list2.kt
new file mode 100644
index 00000000000..cdf8f0f5073
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/list2.kt
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val listOf = listOf(1, 2, 3)
+ 0 == listOf.size
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/list2.kt.after b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/list2.kt.after
new file mode 100644
index 00000000000..b5d00e6e2cc
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/list2.kt.after
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val listOf = listOf(1, 2, 3)
+ listOf.isEmpty()
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/lt.kt b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/lt.kt
new file mode 100644
index 00000000000..aa8a826e025
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/lt.kt
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val listOf = listOf(1, 2, 3)
+ listOf.size < 1
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/lt.kt.after b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/lt.kt.after
new file mode 100644
index 00000000000..b5d00e6e2cc
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/lt.kt.after
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val listOf = listOf(1, 2, 3)
+ listOf.isEmpty()
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/lteq.kt b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/lteq.kt
new file mode 100644
index 00000000000..4df8bd38270
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/lteq.kt
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val listOf = listOf(1, 2, 3)
+ listOf.size <= 0
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/lteq.kt.after b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/lteq.kt.after
new file mode 100644
index 00000000000..b5d00e6e2cc
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/lteq.kt.after
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val listOf = listOf(1, 2, 3)
+ listOf.isEmpty()
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/set.kt b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/set.kt
new file mode 100644
index 00000000000..17b501a75f2
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/set.kt
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val setOf = setOf(1, 2, 3)
+ setOf.size == 0
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/set.kt.after b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/set.kt.after
new file mode 100644
index 00000000000..3811a8edd4a
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/set.kt.after
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val setOf = setOf(1, 2, 3)
+ setOf.isEmpty()
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/sizeCheck.kt b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/sizeCheck.kt
new file mode 100644
index 00000000000..db762023317
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/sizeCheck.kt
@@ -0,0 +1,11 @@
+// WITH_RUNTIME
+// IS_APPLICABLE: false
+
+class List {
+ val size = 0
+}
+
+fun foo() {
+ val list = List()
+ list.size == 0
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/string.kt b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/string.kt
new file mode 100644
index 00000000000..ca3715340b2
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/string.kt
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val text = "123"
+ text.length == 0
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/string.kt.after b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/string.kt.after
new file mode 100644
index 00000000000..e2b0c81a2dd
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/string.kt.after
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val text = "123"
+ text.isEmpty()
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/string2.kt b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/string2.kt
new file mode 100644
index 00000000000..f889bcdd41b
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/string2.kt
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val text = "123"
+ 0 == text.length
+}
\ No newline at end of file
diff --git a/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/string2.kt.after b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/string2.kt.after
new file mode 100644
index 00000000000..e2b0c81a2dd
--- /dev/null
+++ b/idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/string2.kt.after
@@ -0,0 +1,6 @@
+// WITH_RUNTIME
+
+fun foo() {
+ val text = "123"
+ text.isEmpty()
+}
\ 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 efe57f3b323..8a2a7bee687 100644
--- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java
+++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java
@@ -11030,6 +11030,180 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
}
}
+ @TestMetadata("idea/testData/intentions/replaceSizeCheckWithIsNotEmpty")
+ @TestDataPath("$PROJECT_ROOT")
+ @RunWith(JUnit3RunnerWithInners.class)
+ public static class ReplaceSizeCheckWithIsNotEmpty extends AbstractIntentionTest {
+ public void testAllFilesPresentInReplaceSizeCheckWithIsNotEmpty() throws Exception {
+ KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/replaceSizeCheckWithIsNotEmpty"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), true);
+ }
+
+ @TestMetadata("array.kt")
+ public void testArray() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/array.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("array2.kt")
+ public void testArray2() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/array2.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("gt.kt")
+ public void testGt() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/gt.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("gteq.kt")
+ public void testGteq() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/gteq.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("list.kt")
+ public void testList() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/list.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("list2.kt")
+ public void testList2() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/list2.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("lt.kt")
+ public void testLt() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/lt.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("lteq.kt")
+ public void testLteq() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/lteq.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("oppositeSign.kt")
+ public void testOppositeSign() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/oppositeSign.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("oppositeSign2.kt")
+ public void testOppositeSign2() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/oppositeSign2.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("set.kt")
+ public void testSet() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/set.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("sizeCheck.kt")
+ public void testSizeCheck() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/sizeCheck.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("string.kt")
+ public void testString() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/string.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("string2.kt")
+ public void testString2() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeCheckWithIsNotEmpty/string2.kt");
+ doTest(fileName);
+ }
+ }
+
+ @TestMetadata("idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty")
+ @TestDataPath("$PROJECT_ROOT")
+ @RunWith(JUnit3RunnerWithInners.class)
+ public static class ReplaceSizeZeroCheckWithIsEmpty extends AbstractIntentionTest {
+ public void testAllFilesPresentInReplaceSizeZeroCheckWithIsEmpty() throws Exception {
+ KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), true);
+ }
+
+ @TestMetadata("array.kt")
+ public void testArray() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/array.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("array2.kt")
+ public void testArray2() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/array2.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("gt.kt")
+ public void testGt() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/gt.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("gteq.kt")
+ public void testGteq() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/gteq.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("list.kt")
+ public void testList() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/list.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("list2.kt")
+ public void testList2() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/list2.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("lt.kt")
+ public void testLt() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/lt.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("lteq.kt")
+ public void testLteq() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/lteq.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("set.kt")
+ public void testSet() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/set.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("sizeCheck.kt")
+ public void testSizeCheck() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/sizeCheck.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("string.kt")
+ public void testString() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/string.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("string2.kt")
+ public void testString2() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/replaceSizeZeroCheckWithIsEmpty/string2.kt");
+ doTest(fileName);
+ }
+ }
+
@TestMetadata("idea/testData/intentions/replaceSubstringWithDropLast")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)