Refactoring: make "replace get or set" an inspection
This commit is contained in:
@@ -318,6 +318,7 @@ fun main(args: Array<String>) {
|
||||
testClass<AbstractInspectionTest> {
|
||||
model("intentions", pattern = "^(inspections\\.test)$", singleClass = true)
|
||||
model("inspections", pattern = "^(inspections\\.test)$", singleClass = true)
|
||||
model("inspectionsLocal", pattern = "^(inspections\\.test)$", singleClass = true)
|
||||
}
|
||||
|
||||
testClass<AbstractLocalInspectionTest> {
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
inst[a, b]
|
||||
@@ -1 +0,0 @@
|
||||
inst.get(a, b)
|
||||
@@ -1,5 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
This intention replaces <code>get</code> or <code>set</code> function calls with the indexing operator (<code>[]</code>).
|
||||
</body>
|
||||
</html>
|
||||
@@ -812,11 +812,6 @@
|
||||
<category>Kotlin</category>
|
||||
</intentionAction>
|
||||
|
||||
<intentionAction>
|
||||
<className>org.jetbrains.kotlin.idea.intentions.conventionNameCalls.ReplaceGetOrSetIntention</className>
|
||||
<category>Kotlin</category>
|
||||
</intentionAction>
|
||||
|
||||
<intentionAction>
|
||||
<className>org.jetbrains.kotlin.idea.intentions.conventionNameCalls.ReplaceContainsIntention</className>
|
||||
<category>Kotlin</category>
|
||||
@@ -1607,7 +1602,7 @@
|
||||
language="kotlin"
|
||||
/>
|
||||
|
||||
<localInspection implementationClass="org.jetbrains.kotlin.idea.intentions.conventionNameCalls.ReplaceGetOrSetInspection"
|
||||
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.conventionNameCalls.ReplaceGetOrSetInspection"
|
||||
displayName="Explicit 'get' or 'set' call"
|
||||
groupPath="Kotlin"
|
||||
groupName="Style issues"
|
||||
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
* Copyright 2010-2017 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.inspections.conventionNameCalls
|
||||
|
||||
import com.intellij.codeInspection.LocalInspectionToolSession
|
||||
import com.intellij.codeInspection.ProblemHighlightType
|
||||
import com.intellij.codeInspection.ProblemsHolder
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||
import org.jetbrains.kotlin.idea.inspections.AbstractApplicabilityBasedInspection
|
||||
import org.jetbrains.kotlin.idea.intentions.callExpression
|
||||
import org.jetbrains.kotlin.idea.intentions.isReceiverExpressionWithValue
|
||||
import org.jetbrains.kotlin.idea.intentions.toResolvedCall
|
||||
import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getChildOfType
|
||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||
import org.jetbrains.kotlin.resolve.bindingContextUtil.isUsedAsExpression
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
||||
import org.jetbrains.kotlin.resolve.calls.model.isReallySuccess
|
||||
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||
import org.jetbrains.kotlin.util.isValidOperator
|
||||
|
||||
class ReplaceGetOrSetInspection : AbstractApplicabilityBasedInspection<KtDotQualifiedExpression>() {
|
||||
private fun FunctionDescriptor.isExplicitOperator(): Boolean {
|
||||
return if (overriddenDescriptors.isEmpty())
|
||||
containingDeclaration !is JavaClassDescriptor && isOperator
|
||||
else
|
||||
overriddenDescriptors.any { it.isExplicitOperator() }
|
||||
}
|
||||
|
||||
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean, session: LocalInspectionToolSession): KtVisitorVoid =
|
||||
object : KtVisitorVoid() {
|
||||
override fun visitDotQualifiedExpression(expression: KtDotQualifiedExpression) {
|
||||
super.visitDotQualifiedExpression(expression)
|
||||
visitTargetElement(expression, holder, isOnTheFly)
|
||||
}
|
||||
}
|
||||
|
||||
private val operatorNames = setOf(OperatorNameConventions.GET, OperatorNameConventions.SET)
|
||||
|
||||
override fun isApplicable(element: KtDotQualifiedExpression): Boolean {
|
||||
val callExpression = element.callExpression ?: return false
|
||||
val bindingContext = callExpression.analyze(BodyResolveMode.PARTIAL)
|
||||
val resolvedCall = callExpression.getResolvedCall(bindingContext) ?: return false
|
||||
if (!resolvedCall.isReallySuccess()) return false
|
||||
|
||||
val target = resolvedCall.resultingDescriptor as? FunctionDescriptor ?: return false
|
||||
if (!target.isValidOperator() || target.name !in operatorNames) return false
|
||||
|
||||
if (callExpression.typeArgumentList != null) return false
|
||||
|
||||
val arguments = callExpression.valueArguments
|
||||
if (arguments.isEmpty()) return false
|
||||
if (arguments.any { it.isNamed() }) return false
|
||||
|
||||
if (!element.isReceiverExpressionWithValue()) return false
|
||||
|
||||
return target.name != OperatorNameConventions.SET || !element.isUsedAsExpression(bindingContext)
|
||||
}
|
||||
|
||||
override fun inspectionText(element: KtDotQualifiedExpression) = "Call replaceable with indexing operator"
|
||||
|
||||
override fun inspectionHighlightType(element: KtDotQualifiedExpression): ProblemHighlightType {
|
||||
return if ((element.toResolvedCall(BodyResolveMode.PARTIAL)!!.resultingDescriptor as FunctionDescriptor).isExplicitOperator()) {
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING
|
||||
}
|
||||
else {
|
||||
ProblemHighlightType.INFORMATION
|
||||
}
|
||||
}
|
||||
|
||||
override val defaultFixText: String
|
||||
get() = "Replace get or set call with indexing operator"
|
||||
|
||||
override fun fixText(element: KtDotQualifiedExpression): String {
|
||||
val callExpression = element.callExpression ?: return defaultFixText
|
||||
val bindingContext = callExpression.analyze(BodyResolveMode.PARTIAL)
|
||||
val resolvedCall = callExpression.getResolvedCall(bindingContext) ?: return defaultFixText
|
||||
return "Replace '${resolvedCall.resultingDescriptor.name.asString()}' call with indexing operator"
|
||||
}
|
||||
|
||||
override fun inspectionTarget(element: KtDotQualifiedExpression) = element.callExpression?.calleeExpression ?: element
|
||||
|
||||
override fun applyTo(element: PsiElement, project: Project, editor: Editor?) {
|
||||
val expression = element as? KtDotQualifiedExpression ?: element.parent.parent as? KtDotQualifiedExpression ?: return
|
||||
val isSet = expression.toResolvedCall(BodyResolveMode.PARTIAL)!!.resultingDescriptor.name == OperatorNameConventions.SET
|
||||
val allArguments = expression.callExpression!!.valueArguments
|
||||
assert(allArguments.isNotEmpty())
|
||||
|
||||
val newExpression = KtPsiFactory(expression).buildExpression {
|
||||
appendExpression(expression.receiverExpression)
|
||||
|
||||
appendFixedText("[")
|
||||
|
||||
val arguments = if (isSet) allArguments.dropLast(1) else allArguments
|
||||
appendExpressions(arguments.map { it.getArgumentExpression() })
|
||||
|
||||
appendFixedText("]")
|
||||
|
||||
if (isSet) {
|
||||
appendFixedText("=")
|
||||
appendExpression(allArguments.last().getArgumentExpression())
|
||||
}
|
||||
}
|
||||
|
||||
val newElement = expression.replace(newExpression)
|
||||
|
||||
if (editor != null) {
|
||||
moveCaret(editor, isSet, newElement)
|
||||
}
|
||||
}
|
||||
|
||||
private fun moveCaret(editor: Editor, isSet: Boolean, newElement: PsiElement) {
|
||||
val arrayAccessExpression = if (isSet) {
|
||||
newElement.getChildOfType<KtArrayAccessExpression>()!!
|
||||
}
|
||||
else {
|
||||
newElement as KtArrayAccessExpression
|
||||
}
|
||||
|
||||
editor.caretModel.moveToOffset(arrayAccessExpression.leftBracket!!.startOffset)
|
||||
}
|
||||
}
|
||||
-131
@@ -1,131 +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.conventionNameCalls
|
||||
|
||||
import com.intellij.codeInsight.intention.HighPriorityAction
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||
import org.jetbrains.kotlin.idea.inspections.IntentionBasedInspection
|
||||
import org.jetbrains.kotlin.idea.intentions.SelfTargetingRangeIntention
|
||||
import org.jetbrains.kotlin.idea.intentions.callExpression
|
||||
import org.jetbrains.kotlin.idea.intentions.isReceiverExpressionWithValue
|
||||
import org.jetbrains.kotlin.idea.intentions.toResolvedCall
|
||||
import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor
|
||||
import org.jetbrains.kotlin.psi.KtArrayAccessExpression
|
||||
import org.jetbrains.kotlin.psi.KtDotQualifiedExpression
|
||||
import org.jetbrains.kotlin.psi.KtPsiFactory
|
||||
import org.jetbrains.kotlin.psi.buildExpression
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getChildOfType
|
||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||
import org.jetbrains.kotlin.resolve.bindingContextUtil.isUsedAsExpression
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
||||
import org.jetbrains.kotlin.resolve.calls.model.isReallySuccess
|
||||
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||
import org.jetbrains.kotlin.util.isValidOperator
|
||||
|
||||
class ReplaceGetOrSetInspection : IntentionBasedInspection<KtDotQualifiedExpression>(
|
||||
ReplaceGetOrSetIntention::class, ReplaceGetOrSetInspection.additionalChecker
|
||||
|
||||
) {
|
||||
companion object {
|
||||
val additionalChecker = { expression: KtDotQualifiedExpression ->
|
||||
(expression.toResolvedCall(BodyResolveMode.PARTIAL)!!.resultingDescriptor as FunctionDescriptor).isExplicitOperator()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun FunctionDescriptor.isExplicitOperator(): Boolean {
|
||||
return if (overriddenDescriptors.isEmpty())
|
||||
containingDeclaration !is JavaClassDescriptor && isOperator
|
||||
else
|
||||
overriddenDescriptors.any { it.isExplicitOperator() }
|
||||
}
|
||||
|
||||
class ReplaceGetOrSetIntention : SelfTargetingRangeIntention<KtDotQualifiedExpression>(
|
||||
KtDotQualifiedExpression::class.java,
|
||||
"Replace 'get' or 'set' call with indexing operator"
|
||||
), HighPriorityAction {
|
||||
|
||||
private val operatorNames = setOf(OperatorNameConventions.GET, OperatorNameConventions.SET)
|
||||
|
||||
override fun applicabilityRange(element: KtDotQualifiedExpression): TextRange? {
|
||||
val callExpression = element.callExpression ?: return null
|
||||
val bindingContext = callExpression.analyze(BodyResolveMode.PARTIAL)
|
||||
val resolvedCall = callExpression.getResolvedCall(bindingContext) ?: return null
|
||||
if (!resolvedCall.isReallySuccess()) return null
|
||||
|
||||
val target = resolvedCall.resultingDescriptor as? FunctionDescriptor ?: return null
|
||||
if (!target.isValidOperator() || target.name !in operatorNames) return null
|
||||
|
||||
if (callExpression.typeArgumentList != null) return null
|
||||
|
||||
val arguments = callExpression.valueArguments
|
||||
if (arguments.isEmpty()) return null
|
||||
if (arguments.any { it.isNamed() }) return null
|
||||
|
||||
if (!element.isReceiverExpressionWithValue()) return null
|
||||
|
||||
if (target.name == OperatorNameConventions.SET && element.isUsedAsExpression(bindingContext)) return null
|
||||
|
||||
text = "Replace '${target.name.asString()}' call with indexing operator"
|
||||
|
||||
return callExpression.calleeExpression!!.textRange
|
||||
}
|
||||
|
||||
override fun applyTo(element: KtDotQualifiedExpression, editor: Editor?) {
|
||||
val isSet = element.toResolvedCall(BodyResolveMode.PARTIAL)!!.resultingDescriptor.name == OperatorNameConventions.SET
|
||||
val allArguments = element.callExpression!!.valueArguments
|
||||
assert(allArguments.isNotEmpty())
|
||||
|
||||
val expression = KtPsiFactory(element).buildExpression {
|
||||
appendExpression(element.receiverExpression)
|
||||
|
||||
appendFixedText("[")
|
||||
|
||||
val arguments = if (isSet) allArguments.dropLast(1) else allArguments
|
||||
appendExpressions(arguments.map { it.getArgumentExpression() })
|
||||
|
||||
appendFixedText("]")
|
||||
|
||||
if (isSet) {
|
||||
appendFixedText("=")
|
||||
appendExpression(allArguments.last().getArgumentExpression())
|
||||
}
|
||||
}
|
||||
|
||||
val newElement = element.replace(expression)
|
||||
|
||||
if (editor != null) {
|
||||
moveCaret(editor, isSet, newElement)
|
||||
}
|
||||
}
|
||||
|
||||
private fun moveCaret(editor: Editor, isSet: Boolean, newElement: PsiElement) {
|
||||
val arrayAccessExpression = if (isSet) {
|
||||
newElement.getChildOfType<KtArrayAccessExpression>()!!
|
||||
}
|
||||
else {
|
||||
newElement as KtArrayAccessExpression
|
||||
}
|
||||
|
||||
editor.caretModel.moveToOffset(arrayAccessExpression.leftBracket!!.startOffset)
|
||||
}
|
||||
}
|
||||
@@ -27,14 +27,13 @@ import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||
import org.jetbrains.kotlin.idea.core.replaced
|
||||
import org.jetbrains.kotlin.idea.core.setVisibility
|
||||
import org.jetbrains.kotlin.idea.inspections.*
|
||||
import org.jetbrains.kotlin.idea.inspections.conventionNameCalls.ReplaceGetOrSetInspection
|
||||
import org.jetbrains.kotlin.idea.intentions.*
|
||||
import org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.FoldIfToReturnAsymmetricallyIntention
|
||||
import org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.FoldIfToReturnIntention
|
||||
import org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.IfThenToElvisIntention
|
||||
import org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.IfThenToSafeAccessIntention
|
||||
import org.jetbrains.kotlin.idea.intentions.branchedTransformations.isTrivialStatementBody
|
||||
import org.jetbrains.kotlin.idea.intentions.conventionNameCalls.ReplaceGetOrSetInspection
|
||||
import org.jetbrains.kotlin.idea.intentions.conventionNameCalls.ReplaceGetOrSetIntention
|
||||
import org.jetbrains.kotlin.idea.quickfix.RemoveModifierFix
|
||||
import org.jetbrains.kotlin.idea.quickfix.RemoveUselessCastFix
|
||||
import org.jetbrains.kotlin.idea.refactoring.inline.KotlinInlineValHandler
|
||||
@@ -91,7 +90,7 @@ object J2KPostProcessingRegistrar {
|
||||
registerIntentionBasedProcessing(IfThenToSafeAccessIntention())
|
||||
registerIntentionBasedProcessing(IfThenToElvisIntention())
|
||||
registerIntentionBasedProcessing(SimplifyNegatedBinaryExpressionIntention())
|
||||
registerIntentionBasedProcessing(ReplaceGetOrSetIntention(), additionalChecker = ReplaceGetOrSetInspection.additionalChecker)
|
||||
registerInspectionBasedProcessing(ReplaceGetOrSetInspection())
|
||||
registerIntentionBasedProcessing(AddOperatorModifierIntention())
|
||||
registerIntentionBasedProcessing(ObjectLiteralToLambdaIntention())
|
||||
registerIntentionBasedProcessing(AnonymousFunctionToLambdaIntention())
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.inspections.conventionNameCalls.ReplaceGetOrSetInspection
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
// ERROR: An argument is already passed for this parameter
|
||||
// ERROR: No value passed for parameter 'b'
|
||||
fun test() {
|
||||
+18
-18
@@ -4,8 +4,8 @@
|
||||
<line>8</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="singleArgument.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES"/>
|
||||
<description>Replace 'get' call with indexing operator</description>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class>
|
||||
<description>Call replaceable with indexing operator</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
@@ -13,8 +13,8 @@
|
||||
<line>6</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="multiArgument.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES"/>
|
||||
<description>Replace 'get' call with indexing operator</description>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class>
|
||||
<description>Call replaceable with indexing operator</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
@@ -22,8 +22,8 @@
|
||||
<line>6</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="functionalArgument.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES"/>
|
||||
<description>Replace 'get' call with indexing operator</description>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class>
|
||||
<description>Call replaceable with indexing operator</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
@@ -31,8 +31,8 @@
|
||||
<line>7</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="extensionFunction.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES"/>
|
||||
<description>Replace 'get' call with indexing operator</description>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class>
|
||||
<description>Call replaceable with indexing operator</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
@@ -40,8 +40,8 @@
|
||||
<line>6</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="argumentAndFunction.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES"/>
|
||||
<description>Replace 'get' call with indexing operator</description>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class>
|
||||
<description>Call replaceable with indexing operator</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
@@ -49,8 +49,8 @@
|
||||
<line>6</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="acceptableVararg.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES"/>
|
||||
<description>Replace 'get' call with indexing operator</description>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class>
|
||||
<description>Call replaceable with indexing operator</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
@@ -58,8 +58,8 @@
|
||||
<line>8</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="qualifier.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES"/>
|
||||
<description>Replace 'get' call with indexing operator</description>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class>
|
||||
<description>Call replaceable with indexing operator</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
@@ -67,8 +67,8 @@
|
||||
<line>8</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="set.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES"/>
|
||||
<description>Replace 'set' call with indexing operator</description>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class>
|
||||
<description>Call replaceable with indexing operator</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
@@ -76,7 +76,7 @@
|
||||
<line>9</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="set2.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES"/>
|
||||
<description>Replace 'set' call with indexing operator</description>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class>
|
||||
<description>Call replaceable with indexing operator</description>
|
||||
</problem>
|
||||
</problems>
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.conventionNameCalls.ReplaceGetOrSetInspection
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
// ERROR: Cannot find a parameter with this name: c
|
||||
fun test() {
|
||||
class Test{
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
fun test() {
|
||||
class Test{
|
||||
operator fun get(a: Int=1, b: Int=2) : Int = 0
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
// ERROR: 'operator' modifier is inapplicable on this function: must have at least 1 value parameter
|
||||
fun test() {
|
||||
class Test{
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
package p
|
||||
|
||||
class C
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
// ERROR: Unresolved reference: got
|
||||
fun test() {
|
||||
class Test{
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// INTENTION_TEXT: Replace 'set' call with indexing operator
|
||||
// FIX: Replace 'set' call with indexing operator
|
||||
|
||||
class C {
|
||||
operator fun set(s: String, value: Int) {}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// INTENTION_TEXT: Replace 'set' call with indexing operator
|
||||
// FIX: Replace 'set' call with indexing operator
|
||||
|
||||
class C {
|
||||
operator fun set(s: String, value: Int) {}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// INTENTION_TEXT: Replace 'set' call with indexing operator
|
||||
// FIX: Replace 'set' call with indexing operator
|
||||
|
||||
class C {
|
||||
operator fun set(s: String, p: Int, value: Int): Boolean = true
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// INTENTION_TEXT: Replace 'set' call with indexing operator
|
||||
// FIX: Replace 'set' call with indexing operator
|
||||
|
||||
class C {
|
||||
operator fun set(s: String, p: Int, value: Int): Boolean = true
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
|
||||
class C {
|
||||
operator fun set(s: String, value: Int): Boolean = true
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
// ERROR: 'operator' modifier is inapplicable on this function: must have at least 2 value parameters
|
||||
|
||||
class C {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
// ERROR: 'operator' modifier is inapplicable on this function: last parameter should not have a default value or be a vararg
|
||||
|
||||
class C {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// INTENTION_TEXT: Replace 'get' call with indexing operator
|
||||
// FIX: Replace 'get' call with indexing operator
|
||||
|
||||
fun test() {
|
||||
class Test{
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// INTENTION_TEXT: Replace 'get' call with indexing operator
|
||||
// FIX: Replace 'get' call with indexing operator
|
||||
|
||||
fun test() {
|
||||
class Test{
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
fun foo() {
|
||||
JavaClass.<caret>get(JavaClass())
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
|
||||
open class Base {
|
||||
open operator fun get(s: String) = ""
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
// ERROR: 'operator' modifier is inapplicable on this function: must be a member or an extension function
|
||||
|
||||
package p
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
fun test() {
|
||||
class Test{
|
||||
operator fun get(a: Int, vararg b: Int, c: Int = 0) : Int = 0
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
fun test() {
|
||||
class Test{
|
||||
operator fun get(a: Int = 0, b: Int = 1, c: Int = 2, d: Int = 3) : Int = 0
|
||||
@@ -1 +0,0 @@
|
||||
org.jetbrains.kotlin.idea.intentions.conventionNameCalls.ReplaceGetOrSetIntention
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.intentions.conventionNameCalls.ReplaceGetOrSetInspection
|
||||
@@ -50,12 +50,6 @@ public class InspectionTestGenerated extends AbstractInspectionTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("conventionNameCalls/replaceGetOrSet/inspectionData/inspections.test")
|
||||
public void testConventionNameCalls_replaceGetOrSet_inspectionData_Inspections_test() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet/inspectionData/inspections.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("convertToStringTemplate/inspectionData/inspections.test")
|
||||
public void testConvertToStringTemplate_inspectionData_Inspections_test() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToStringTemplate/inspectionData/inspections.test");
|
||||
@@ -485,4 +479,19 @@ public class InspectionTestGenerated extends AbstractInspectionTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/inspectionsLocal")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class InspectionsLocal extends AbstractInspectionTest {
|
||||
public void testAllFilesPresentInInspectionsLocal() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentInSingleGeneratedClass(this.getClass(), new File("idea/testData/inspectionsLocal"), Pattern.compile("^(inspections\\.test)$"), TargetBackend.ANY);
|
||||
}
|
||||
|
||||
@TestMetadata("conventionNameCalls/replaceGetOrSet/inspectionData/inspections.test")
|
||||
public void testConventionNameCalls_replaceGetOrSet_inspectionData_Inspections_test() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet/inspectionData/inspections.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,21 @@ abstract class AbstractLocalInspectionTest : KotlinLightCodeInsightFixtureTestCa
|
||||
DirectiveBasedActionUtils.checkForUnexpectedErrors(file as KtFile)
|
||||
}
|
||||
|
||||
val psiFile = myFixture.configureByFiles(mainFile.name).first()
|
||||
var i = 1
|
||||
val extraFileNames = mutableListOf<String>()
|
||||
extraFileLoop@ while (true) {
|
||||
for (extension in EXTENSIONS) {
|
||||
val extraFile = File(mainFile.parent, FileUtil.getNameWithoutExtension(mainFile) + "." + i + extension)
|
||||
if (extraFile.exists()) {
|
||||
extraFileNames += extraFile.name
|
||||
i++
|
||||
continue@extraFileLoop
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
val psiFile = myFixture.configureByFiles(*(listOf(mainFile.name) + extraFileNames).toTypedArray()).first()
|
||||
|
||||
doTestFor(mainFile.name, psiFile.virtualFile!!, inspection, fileText)
|
||||
|
||||
@@ -168,5 +182,7 @@ abstract class AbstractLocalInspectionTest : KotlinLightCodeInsightFixtureTestCa
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val EXTENSIONS = arrayOf(".kt", ".kts", ".java", ".groovy")
|
||||
}
|
||||
}
|
||||
@@ -522,6 +522,162 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/inspectionsLocal/conventionNameCalls")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ConventionNameCalls extends AbstractLocalInspectionTest {
|
||||
public void testAllFilesPresentInConventionNameCalls() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/inspectionsLocal/conventionNameCalls"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ReplaceGetOrSet extends AbstractLocalInspectionTest {
|
||||
@TestMetadata("acceptableVararg.kt")
|
||||
public void testAcceptableVararg() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet/acceptableVararg.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInReplaceGetOrSet() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("argumentAndFunction.kt")
|
||||
public void testArgumentAndFunction() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet/argumentAndFunction.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("duplicateArguments.kt")
|
||||
public void testDuplicateArguments() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet/duplicateArguments.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionFunction.kt")
|
||||
public void testExtensionFunction() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet/extensionFunction.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("functionalArgument.kt")
|
||||
public void testFunctionalArgument() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet/functionalArgument.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("invalidArgument.kt")
|
||||
public void testInvalidArgument() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet/invalidArgument.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("missingDefaultArgument.kt")
|
||||
public void testMissingDefaultArgument() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet/missingDefaultArgument.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("multiArgument.kt")
|
||||
public void testMultiArgument() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet/multiArgument.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noArgument.kt")
|
||||
public void testNoArgument() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet/noArgument.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("notOperator.kt")
|
||||
public void testNotOperator() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet/notOperator.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("qualifier.kt")
|
||||
public void testQualifier() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet/qualifier.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("sanityCheck.kt")
|
||||
public void testSanityCheck() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet/sanityCheck.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("set.kt")
|
||||
public void testSet() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet/set.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("set2.kt")
|
||||
public void testSet2() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet/set2.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("setValueUsed.kt")
|
||||
public void testSetValueUsed() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet/setValueUsed.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("setWithNoParameters.kt")
|
||||
public void testSetWithNoParameters() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet/setWithNoParameters.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("setWithVararg.kt")
|
||||
public void testSetWithVararg() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet/setWithVararg.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("singleArgument.kt")
|
||||
public void testSingleArgument() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet/singleArgument.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("staticMethod.kt")
|
||||
public void testStaticMethod() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet/staticMethod.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("super.kt")
|
||||
public void testSuper() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet/super.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("topLevelFun.kt")
|
||||
public void testTopLevelFun() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet/topLevelFun.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("unacceptableVararg.kt")
|
||||
public void testUnacceptableVararg() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet/unacceptableVararg.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("unnamedAndNamed.kt")
|
||||
public void testUnnamedAndNamed() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/conventionNameCalls/replaceGetOrSet/unnamedAndNamed.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/inspectionsLocal/copyWithoutNamedArguments")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -3839,153 +3839,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ReplaceGetOrSet extends AbstractIntentionTest {
|
||||
@TestMetadata("acceptableVararg.kt")
|
||||
public void testAcceptableVararg() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet/acceptableVararg.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInReplaceGetOrSet() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/conventionNameCalls/replaceGetOrSet"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("argumentAndFunction.kt")
|
||||
public void testArgumentAndFunction() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet/argumentAndFunction.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("duplicateArguments.kt")
|
||||
public void testDuplicateArguments() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet/duplicateArguments.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionFunction.kt")
|
||||
public void testExtensionFunction() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet/extensionFunction.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("functionalArgument.kt")
|
||||
public void testFunctionalArgument() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet/functionalArgument.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("invalidArgument.kt")
|
||||
public void testInvalidArgument() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet/invalidArgument.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("missingDefaultArgument.kt")
|
||||
public void testMissingDefaultArgument() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet/missingDefaultArgument.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("multiArgument.kt")
|
||||
public void testMultiArgument() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet/multiArgument.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noArgument.kt")
|
||||
public void testNoArgument() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet/noArgument.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("notOperator.kt")
|
||||
public void testNotOperator() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet/notOperator.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("qualifier.kt")
|
||||
public void testQualifier() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet/qualifier.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("sanityCheck.kt")
|
||||
public void testSanityCheck() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet/sanityCheck.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("set.kt")
|
||||
public void testSet() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet/set.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("set2.kt")
|
||||
public void testSet2() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet/set2.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("setValueUsed.kt")
|
||||
public void testSetValueUsed() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet/setValueUsed.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("setWithNoParameters.kt")
|
||||
public void testSetWithNoParameters() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet/setWithNoParameters.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("setWithVararg.kt")
|
||||
public void testSetWithVararg() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet/setWithVararg.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("singleArgument.kt")
|
||||
public void testSingleArgument() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet/singleArgument.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("staticMethod.kt")
|
||||
public void testStaticMethod() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet/staticMethod.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("super.kt")
|
||||
public void testSuper() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet/super.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("topLevelFun.kt")
|
||||
public void testTopLevelFun() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet/topLevelFun.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("unacceptableVararg.kt")
|
||||
public void testUnacceptableVararg() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet/unacceptableVararg.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("unnamedAndNamed.kt")
|
||||
public void testUnnamedAndNamed() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/conventionNameCalls/replaceGetOrSet/unnamedAndNamed.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/intentions/conventionNameCalls/replaceInvoke")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user