Do not put inapplicable annotations on getter

This commit is contained in:
Yan Zhulanow
2015-10-08 19:41:08 +03:00
parent 9ae3b0fa9c
commit 9699708fb8
4 changed files with 32 additions and 4 deletions
@@ -78,6 +78,7 @@ public class AnnotationSplitter(
val map = hashMapOf<AnnotationUseSiteTarget, MutableList<AnnotationWithTarget>>()
val other = arrayListOf<AnnotationWithTarget>()
val applicableTargets = applicableTargetsLazy()
val applicableTargetsWithoutUseSiteTarget = applicableTargets.intersect(TARGET_PRIORITIES)
outer@ for (annotationWithTarget in allAnnotations.getAllAnnotations()) {
val useSiteTarget = annotationWithTarget.target
@@ -91,7 +92,7 @@ public class AnnotationSplitter(
}
for (target in TARGET_PRIORITIES) {
if (target !in applicableTargets) continue
if (target !in applicableTargetsWithoutUseSiteTarget) continue
val declarationSiteTargetForCurrentTarget = KotlinTarget.USE_SITE_MAPPING[target] ?: continue
val applicableTargetsForAnnotation = AnnotationChecker.applicableTargetSet(annotationWithTarget.annotation)
@@ -115,7 +116,7 @@ public class AnnotationSplitter(
return CompositeAnnotations(targets.map { getAnnotationsForTarget(it) })
}
private inner class LazySplitAnnotations(storageManager: StorageManager, target: AnnotationUseSiteTarget?) : Annotations {
private inner class LazySplitAnnotations(storageManager: StorageManager, val target: AnnotationUseSiteTarget?) : Annotations {
private val annotations by storageManager.createLazyValue {
val splitAnnotations = this@AnnotationSplitter.splitAnnotations()
@@ -1067,7 +1067,6 @@ public class DescriptorResolver {
if (getter != null) {
Annotations getterAnnotations = new CompositeAnnotations(CollectionsKt.listOf(
annotationSplitter.getAnnotationsForTarget(PROPERTY_GETTER),
annotationSplitter.getOtherAnnotations(),
annotationResolver.resolveAnnotationsWithoutArguments(scope, getter.getModifierList(), trace)));
JetType outType = propertyDescriptor.getType();