Inspection/Intention replace size check with 'isNotEmpty' and 'isEmpty' #KT-13937 Fixed

This commit is contained in:
shiraji
2016-10-01 17:34:35 +09:00
committed by Mikhail Glukhikh
parent 5fa561eb70
commit 32b7b5a092
64 changed files with 699 additions and 0 deletions
@@ -0,0 +1,5 @@
<html>
<body>
This inspection detects size checks of Collections/Array/String that should be replaced with 'isNotEmpty()'
</body>
</html>
@@ -0,0 +1,5 @@
<html>
<body>
This inspection detects size zero checks of Collections/Array/String that should be replaced with 'isEmpty()'
</body>
</html>
@@ -0,0 +1 @@
<spot>list.isNotEmpty()</spot>
@@ -0,0 +1 @@
<spot>list.size > 0</spot>
@@ -0,0 +1,5 @@
<html>
<body>
This intention replaces size check with 'isNotEmpty()'
</body>
</html>
@@ -0,0 +1 @@
<spot>list.isEmpty()</spot>
@@ -0,0 +1 @@
<spot>list.size == 0</spot>
@@ -0,0 +1,5 @@
<html>
<body>
This intention replaces size 0 check with 'isEmpty()'
</body>
</html>
+26
View File
@@ -1375,6 +1375,16 @@
<category>Kotlin</category>
</intentionAction>
<intentionAction>
<className>org.jetbrains.kotlin.idea.intentions.ReplaceSizeCheckWithIsNotEmptyIntention</className>
<category>Kotlin</category>
</intentionAction>
<intentionAction>
<className>org.jetbrains.kotlin.idea.intentions.ReplaceSizeZeroCheckWithIsEmptyIntention</className>
<category>Kotlin</category>
</intentionAction>
<localInspection implementationClass="org.jetbrains.kotlin.idea.intentions.ObjectLiteralToLambdaInspection"
displayName="Object literal can be converted to lambda"
groupName="Kotlin"
@@ -1808,6 +1818,22 @@
language="kotlin"
/>
<localInspection implementationClass="org.jetbrains.kotlin.idea.intentions.ReplaceSizeCheckWithIsNotEmptyInspection"
displayName="Replace size check with 'isNotEmpty()'"
groupName="Kotlin"
enabledByDefault="true"
level="WARNING"
language="kotlin"
/>
<localInspection implementationClass="org.jetbrains.kotlin.idea.intentions.ReplaceSizeZeroCheckWithIsEmptyInspection"
displayName="Replace size zero check with 'isEmpty()'"
groupName="Kotlin"
enabledByDefault="true"
level="WARNING"
language="kotlin"
/>
<referenceImporter implementation="org.jetbrains.kotlin.idea.quickfix.KotlinReferenceImporter"/>
<fileType.fileViewProviderFactory filetype="KJSM" implementationClass="com.intellij.psi.ClassFileViewProviderFactory"/>
@@ -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>(
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
}
@@ -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<KtBinaryExpression>(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
}
}
}
@@ -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<KtBinaryExpression>(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
}
}
}
@@ -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<KtExpression?> {
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<out CallableDescriptor>.resolvedToArrayType() =
resultingDescriptor.returnType?.nameIfStandardType == arrayName
fun ResolvedCall<out CallableDescriptor>.resolvedToCollectionType() =
resultingDescriptor.returnType?.constructor?.supertypes?.firstOrNull {
it.nameIfStandardType == collectionName
} != null
fun ResolvedCall<out CallableDescriptor>.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()
}
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.intentions.ReplaceSizeCheckWithIsNotEmptyIntention
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val arrayOf = arrayOf(1, 2, 3)
arrayOf.size<caret> > 0
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val arrayOf = arrayOf(1, 2, 3)
arrayOf.isNotEmpty()
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val arrayOf = arrayOf(1, 2, 3)
0 < arrayOf.size<caret>
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val arrayOf = arrayOf(1, 2, 3)
arrayOf.isNotEmpty()
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val listOf = listOf(1, 2, 3)
listOf.size<caret> > 0
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val listOf = listOf(1, 2, 3)
listOf.isNotEmpty()
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val listOf = listOf(1, 2, 3)
listOf.size<caret> >= 1
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val listOf = listOf(1, 2, 3)
listOf.isNotEmpty()
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val listOf = listOf(1, 2, 3)
listOf.size<caret> > 0
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val listOf = listOf(1, 2, 3)
listOf.isNotEmpty()
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val listOf = listOf(1, 2, 3)
0 < listOf.size<caret>
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val listOf = listOf(1, 2, 3)
listOf.isNotEmpty()
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val listOf = listOf(1, 2, 3)
0 < listOf.size<caret>
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val listOf = listOf(1, 2, 3)
listOf.isNotEmpty()
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val listOf = listOf(1, 2, 3)
1 <= listOf.size<caret>
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val listOf = listOf(1, 2, 3)
listOf.isNotEmpty()
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
fun foo() {
val arrayOf = arrayOf(1, 2, 3)
arrayOf.size<caret> < 0
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
fun foo() {
val arrayOf = arrayOf(1, 2, 3)
0 > arrayOf.size<caret> 0
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val setOf = setOf(1, 2, 3)
setOf.size<caret> > 0
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val setOf = setOf(1, 2, 3)
setOf.isNotEmpty()
}
@@ -0,0 +1,11 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
class List {
val size = 0
}
fun foo() {
val list = List()
list.size<caret> > 0
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val text = "123"
text.length<caret> > 0
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val text = "123"
text.isNotEmpty()
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val text = "123"
0 < text.length<caret>
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val text = "123"
text.isNotEmpty()
}
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.intentions.ReplaceSizeZeroCheckWithIsEmptyIntention
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val arrayOf = arrayOf(1, 2, 3)
arrayOf.size<caret> == 0
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val arrayOf = arrayOf(1, 2, 3)
arrayOf.isEmpty()
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val arrayOf = arrayOf(1, 2, 3)
0 == arrayOf.size<caret>
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val arrayOf = arrayOf(1, 2, 3)
arrayOf.isEmpty()
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val listOf = listOf(1, 2, 3)
1 > listOf.size<caret>
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val listOf = listOf(1, 2, 3)
listOf.isEmpty()
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val listOf = listOf(1, 2, 3)
0 >= listOf.size<caret>
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val listOf = listOf(1, 2, 3)
listOf.isEmpty()
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val listOf = listOf(1, 2, 3)
listOf.size<caret> == 0
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val listOf = listOf(1, 2, 3)
listOf.isEmpty()
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val listOf = listOf(1, 2, 3)
0 == listOf.size<caret>
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val listOf = listOf(1, 2, 3)
listOf.isEmpty()
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val listOf = listOf(1, 2, 3)
listOf.size<caret> < 1
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val listOf = listOf(1, 2, 3)
listOf.isEmpty()
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val listOf = listOf(1, 2, 3)
listOf.size<caret> <= 0
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val listOf = listOf(1, 2, 3)
listOf.isEmpty()
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val setOf = setOf(1, 2, 3)
setOf.size<caret> == 0
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val setOf = setOf(1, 2, 3)
setOf.isEmpty()
}
@@ -0,0 +1,11 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
class List {
val size = 0
}
fun foo() {
val list = List()
list.size<caret> == 0
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val text = "123"
text.length<caret> == 0
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val text = "123"
text.isEmpty()
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val text = "123"
0 == text.length<caret>
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
val text = "123"
text.isEmpty()
}
@@ -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)