This commit is contained in:
Valentin Kipyatkov
2015-09-01 16:17:21 +03:00
parent 416ac6dfd8
commit 4fa13408de
2 changed files with 4 additions and 4 deletions
@@ -199,7 +199,7 @@ public val DeclarationDescriptor.parentsWithSelf: Sequence<DeclarationDescriptor
public val DeclarationDescriptor.parents: Sequence<DeclarationDescriptor>
get() = parentsWithSelf.drop(1)
private val HIDDEN_ANNOTATION_FQ_NAME = FqName("kotlin.HiddenDeclaration") /*TODO*/
private val HIDDEN_ANNOTATION_FQ_NAME = FqName(HiddenDeclaration::class.qualifiedName!!)
public fun DeclarationDescriptor.isAnnotatedAsHidden(): Boolean = annotations.findAnnotation(HIDDEN_ANNOTATION_FQ_NAME) != null
@@ -107,10 +107,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
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
val replaceWithValue = annotation.argumentValue(kotlin.deprecated::replaceWith.name) as? AnnotationDescriptor ?: return null
val pattern = replaceWithValue.argumentValue(kotlin.ReplaceWith::expression.name) as? String ?: return null
if (pattern.isEmpty()) return null
val importValues = replaceWithValue.argumentValue("imports"/*TODO: kotlin.ReplaceWith::imports.name*/) as? List<*> ?: return null
val importValues = replaceWithValue.argumentValue(kotlin.ReplaceWith::imports.name) as? List<*> ?: return null
if (importValues.any { it !is StringValue }) return null
val imports = importValues.map { (it as StringValue).value }