@NotNull private Annotations addExtensionFunctionTypeAnnotation(@NotNull Annotations annotations) { if (annotations.findAnnotation(FQ_NAMES.extensionFunctionType) != null) return annotations; // TODO: preserve laziness of given annotations return new AnnotationsImpl(plus(annotations, listOf(createExtensionAnnotation()))); }
private static boolean containsAnnotation( DeclarationDescriptor descriptor, FqName annotationClassFqName) { DeclarationDescriptor original = descriptor.getOriginal(); Annotations annotations = original.getAnnotations(); if (annotations.findAnnotation(annotationClassFqName) != null) return true; AnnotationUseSiteTarget associatedUseSiteTarget = AnnotationUseSiteTarget.Companion.getAssociatedUseSiteTarget(descriptor); if (associatedUseSiteTarget != null) { if (Annotations.Companion.findUseSiteTargetedAnnotation( annotations, associatedUseSiteTarget, annotationClassFqName) != null) { return true; } } return false; }