ReplaceJavaStaticMethodWithKotlinAnalogInspection: simplify Transform for default action
This commit is contained in:
@@ -23,11 +23,9 @@ interface Transformation {
|
|||||||
object WithoutAdditionalTransformation : Transformation {
|
object WithoutAdditionalTransformation : Transformation {
|
||||||
override fun invoke(callExpression: KtCallExpression, replacement: Replacement) {
|
override fun invoke(callExpression: KtCallExpression, replacement: Replacement) {
|
||||||
val psiFactory = KtPsiFactory(callExpression)
|
val psiFactory = KtPsiFactory(callExpression)
|
||||||
val valueArguments = callExpression.valueArguments
|
val calleeLength = callExpression.calleeExpression?.textLength ?: return
|
||||||
val typeArguments = callExpression.typeArgumentList?.text ?: ""
|
|
||||||
val argumentsText = valueArguments.joinToString(separator = ", ") { it.text }
|
|
||||||
val replaced = callExpression.getQualifiedExpressionForSelectorOrThis().replaced(
|
val replaced = callExpression.getQualifiedExpressionForSelectorOrThis().replaced(
|
||||||
psiFactory.createExpression("${replacement.kotlinFunctionFqName}$typeArguments($argumentsText)")
|
psiFactory.createExpression("${replacement.kotlinFunctionFqName}${callExpression.text.substring(calleeLength)}")
|
||||||
)
|
)
|
||||||
ShortenReferences.DEFAULT.process(replaced)
|
ShortenReferences.DEFAULT.process(replaced)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user