Edited TODOs
This commit is contained in:
@@ -448,7 +448,7 @@ public class CommentSaver(originalElements: PsiChildRange, private val saveLineB
|
||||
private val nonSpaceAndNonEmptyFilter = { element: PsiElement -> element !is PsiWhiteSpace && element.getTextLength() > 0 }
|
||||
|
||||
companion object {
|
||||
//TODO: making it private causes error on runtime
|
||||
//TODO: making it private causes error on runtime (KT-7874?)
|
||||
val PsiElement.tokenType: JetToken?
|
||||
get() = getNode().getElementType() as? JetToken
|
||||
}
|
||||
|
||||
+1
-2
@@ -46,7 +46,6 @@ public class DeprecatedCallableAddReplaceWithInspection : IntentionBasedInspecti
|
||||
public class DeprecatedCallableAddReplaceWithIntention : JetSelfTargetingRangeIntention<JetCallableDeclaration>(
|
||||
javaClass(), "Add 'replaceWith' argument to specify replacement pattern", "Add 'replaceWith' argument to 'deprecated' annotation"
|
||||
) {
|
||||
//TODO: use ReplaceWith from package kotlin
|
||||
private class ReplaceWith(val expression: String, vararg val imports: String)
|
||||
|
||||
override fun applicabilityRange(element: JetCallableDeclaration): TextRange? {
|
||||
@@ -99,7 +98,7 @@ public class DeprecatedCallableAddReplaceWithIntention : JetSelfTargetingRangeIn
|
||||
if (DescriptorUtils.getFqName(descriptor).asString() != "kotlin.deprecated") continue
|
||||
|
||||
val replaceWithArguments = resolvedCall.getValueArguments().entrySet()
|
||||
.single { it.key.getName().asString() == "replaceWith"/*TODO*/ }.value
|
||||
.single { it.key.getName().asString() == "replaceWith"/*TODO: kotlin.deprecated::replaceWith.name*/ }.value
|
||||
return if (replaceWithArguments.getArguments().isEmpty()) entry else null
|
||||
}
|
||||
return null
|
||||
|
||||
@@ -109,11 +109,10 @@ public abstract class DeprecatedSymbolUsageFixBase(
|
||||
public fun replaceWithPattern(descriptor: DeclarationDescriptor, project: Project): ReplaceWith? {
|
||||
val annotationClass = descriptor.builtIns.getDeprecatedAnnotation()
|
||||
val annotation = descriptor.getAnnotations().findAnnotation(DescriptorUtils.getFqNameSafe(annotationClass)) ?: return null
|
||||
//TODO: code duplication
|
||||
val replaceWithValue = annotation.argumentValue("replaceWith"/*TODO*/) as? AnnotationDescriptor ?: return null
|
||||
val pattern = replaceWithValue.argumentValue("expression"/*TODO*/) as? String ?: return null
|
||||
val replaceWithValue = annotation.argumentValue("replaceWith"/*TODO: kotlin.deprecated::replaceWith.name*/) as? AnnotationDescriptor ?: return null
|
||||
val pattern = replaceWithValue.argumentValue("expression"/*TODO: kotlin.ReplaceWith::expression.name*/) as? String ?: return null
|
||||
if (pattern.isEmpty()) return null
|
||||
val importValues = replaceWithValue.argumentValue("imports"/*TODO*/) as? List<*> ?: return null
|
||||
val importValues = replaceWithValue.argumentValue("imports"/*TODO: kotlin.ReplaceWith::imports.name*/) as? List<*> ?: return null
|
||||
if (importValues.any { it !is StringValue }) return null
|
||||
val imports = importValues.map { (it as StringValue).getValue() }
|
||||
|
||||
@@ -303,8 +302,6 @@ public abstract class DeprecatedSymbolUsageFixBase(
|
||||
resolvedCall: ResolvedCall<out CallableDescriptor>,
|
||||
bindingContext: BindingContext,
|
||||
project: Project): Argument? {
|
||||
//TODO: named parameters - keep named form if makes sense
|
||||
//TODO: keep functional literal argument form
|
||||
val resolvedArgument = resolvedCall.getValueArguments()[parameter]!!
|
||||
when (resolvedArgument) {
|
||||
is ExpressionValueArgument -> {
|
||||
@@ -550,7 +547,6 @@ public abstract class DeprecatedSymbolUsageFixBase(
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: do this before processing of optional parameters
|
||||
private fun restoreFunctionLiteralArguments(expression: JetExpression) {
|
||||
val callExpressions = ArrayList<JetCallExpression>()
|
||||
|
||||
|
||||
@@ -49,7 +49,6 @@ import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
||||
import java.util.ArrayList
|
||||
import java.util.LinkedHashSet
|
||||
|
||||
//TODO: use ReplaceWith from package kotlin
|
||||
data class ReplaceWith(val expression: String, vararg val imports: String)
|
||||
|
||||
object ReplaceWithAnnotationAnalyzer {
|
||||
|
||||
Reference in New Issue
Block a user