Ejemplo n.º 1
0
  @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())));
  }
Ejemplo n.º 2
0
  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;
  }