Disable old Parcelable quickfixes if @Parcelize annotation is present

This commit is contained in:
Yan Zhulanow
2017-09-12 23:53:15 +03:00
committed by Yan Zhulanow
parent e6171dc4c5
commit d9f99971bb
10 changed files with 48 additions and 0 deletions
@@ -72,6 +72,10 @@ fun KtAnnotated.findAnnotation(annotationFqName: FqName): KtAnnotationEntry? {
if (annotationEntries.isEmpty()) return null
val context = analyze(bodyResolveMode = BodyResolveMode.PARTIAL)
val descriptor = context[BindingContext.DECLARATION_TO_DESCRIPTOR, this] ?: return null
// Make sure all annotations are resolved
descriptor.annotations.toList()
return annotationEntries.firstOrNull { entry -> context.get(BindingContext.ANNOTATION, entry)?.fqName == annotationFqName }
}