DeprecatedSymbolUsageFix: fixed for java declaration + one more test

This commit is contained in:
Valentin Kipyatkov
2015-05-26 17:55:56 +03:00
parent 18c19457f0
commit 697516cfdd
7 changed files with 43 additions and 2 deletions
@@ -107,7 +107,8 @@ public abstract class DeprecatedSymbolUsageFixBase(
companion object {
public fun replaceWithPattern(descriptor: DeclarationDescriptor): ReplaceWith? {
val annotationClass = descriptor.builtIns.getDeprecatedAnnotation()
val annotation = descriptor.getAnnotations().findAnnotation(DescriptorUtils.getFqNameSafe(annotationClass))!!
val annotation = descriptor.getAnnotations().findAnnotation(DescriptorUtils.getFqNameSafe(annotationClass)) ?: return null
//TODO: code duplication
val replaceWithValue = annotation.getAllValueArguments().entrySet()
.singleOrNull { it.key.getName().asString() == "replaceWith"/*TODO*/ }
?.value?.getValue() as? AnnotationDescriptor ?: return null