Search in sources :

Example 1 with LazyAnnotationDescriptor

use of org.jetbrains.kotlin.resolve.lazy.descriptors.LazyAnnotationDescriptor in project kotlin by JetBrains.

the class AnnotationResolverImpl method resolveAnnotationEntries.

@NotNull
@Override
public Annotations resolveAnnotationEntries(@NotNull LexicalScope scope, @NotNull List<KtAnnotationEntry> annotationEntryElements, @NotNull BindingTrace trace, boolean shouldResolveArguments) {
    if (annotationEntryElements.isEmpty())
        return Annotations.Companion.getEMPTY();
    List<AnnotationWithTarget> result = new ArrayList<AnnotationWithTarget>(0);
    for (KtAnnotationEntry entryElement : annotationEntryElements) {
        AnnotationDescriptor descriptor = trace.get(BindingContext.ANNOTATION, entryElement);
        if (descriptor == null) {
            descriptor = new LazyAnnotationDescriptor(new LazyAnnotationsContextImpl(this, storageManager, trace, scope), entryElement);
        }
        if (shouldResolveArguments) {
            ForceResolveUtil.forceResolveAllContents(descriptor);
        }
        KtAnnotationUseSiteTarget target = entryElement.getUseSiteTarget();
        if (target != null) {
            result.add(new AnnotationWithTarget(descriptor, target.getAnnotationUseSiteTarget()));
        } else {
            result.add(new AnnotationWithTarget(descriptor, null));
        }
    }
    return AnnotationsImpl.create(result);
}
Also used : LazyAnnotationDescriptor(org.jetbrains.kotlin.resolve.lazy.descriptors.LazyAnnotationDescriptor) LazyAnnotationDescriptor(org.jetbrains.kotlin.resolve.lazy.descriptors.LazyAnnotationDescriptor) ArrayList(java.util.ArrayList) LazyAnnotationsContextImpl(org.jetbrains.kotlin.resolve.lazy.descriptors.LazyAnnotationsContextImpl) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ArrayList (java.util.ArrayList)1 NotNull (org.jetbrains.annotations.NotNull)1 LazyAnnotationDescriptor (org.jetbrains.kotlin.resolve.lazy.descriptors.LazyAnnotationDescriptor)1 LazyAnnotationsContextImpl (org.jetbrains.kotlin.resolve.lazy.descriptors.LazyAnnotationsContextImpl)1