diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationResolverImpl.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationResolverImpl.java index 463c1a05081..aa401984bd4 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationResolverImpl.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationResolverImpl.java @@ -96,7 +96,6 @@ public class AnnotationResolverImpl extends AnnotationResolver { if (descriptor == null) { LazyAnnotationDescriptor lazyAnnotationDescriptor = new LazyAnnotationDescriptor(new LazyAnnotationsContextImpl(this, storageManager, trace, scope), entryElement); - lazyAnnotationDescriptor.recordToTrace(); descriptor = lazyAnnotationDescriptor; } if (shouldResolveArguments) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyAnnotations.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyAnnotations.kt index 5a87d9a150d..36c9d16b93e 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyAnnotations.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyAnnotations.kt @@ -60,7 +60,7 @@ class LazyAnnotations( override fun isEmpty() = annotationEntries.isEmpty() private val annotation = c.storageManager.createMemoizedFunction { entry: KtAnnotationEntry -> - c.trace.get(BindingContext.ANNOTATION, entry) ?: LazyAnnotationDescriptor(c, entry).also { it.recordToTrace() } + c.trace.get(BindingContext.ANNOTATION, entry) ?: LazyAnnotationDescriptor(c, entry) } override fun iterator(): Iterator = annotationEntries.asSequence().map(annotation).iterator() @@ -121,6 +121,10 @@ class LazyAnnotationDescriptor( valueArgumentsWithSourceInfo.mapValues { it.value.first } } + init { + c.trace.record(BindingContext.ANNOTATION, annotationEntry, this) + } + fun getSourceForArgument(name: Name): SourceElement = valueArgumentsWithSourceInfo[name]?.second ?: SourceElement.NO_SOURCE @@ -129,10 +133,6 @@ class LazyAnnotationDescriptor( allValueArguments } - fun recordToTrace() { - c.trace.record(BindingContext.ANNOTATION, annotationEntry, this) - } - private class FileDescriptorForVisibilityChecks( private val source: SourceElement, private val containingDeclaration: PackageFragmentDescriptor