Uploaded image for project: 'CDI Specification Issues'
  1. CDI Specification Issues
  2. CDI-460

Support repeating annotations in CDI SPI

XMLWordPrintable

    • Icon: Clarification Clarification
    • Resolution: Done
    • Icon: Major Major
    • 2.0 .Final
    • None
    • Portable Extensions
    • None

      In CDI 1.2, it is not explicitly stated whether altering the annotation-based metadata in a way to add multiple annotations of the same type is possible or not. That situation occurs with the following combinations:

      AnnotatedType.getAnnotations() and ProcessAnnotatedType.setAnnotatedType(AnnotatedType at),
      BeanAttributes.getQualifiers(), and ProcessBeanAttributes.setBeanAttributes(BeanAttributes ba),
      InjectionPoint.getQualifiers and ProcessInjectionPoint.setInjectionPoint(InjectionPoint ip).

      Being able to decorate these metadata with repeating annotations enables powerful and elegant use cases as discussed in OWB-1004, that is the ability to use an annotation both as a CDI qualifier and a metadata provider during injection.

      Given that Java 8 provides support for repeating annotations, it seems logical to have repeating annotations supported at the CDI SPI level. Though, that's important to have that support explicitly stated and specified in CDI.

      Indeed, while Weld permits metadata alteration with repeating annotations, OpenWebBeans does not for the moment though developers understand the need and are willing to open that behavior as discussed in OWB-1004 as long as that support will be made explicit in the specification.

      That applies as well for EventMetadata.getQualifiers in read-only.

      While that request is technically independent from Java 8, it is correlated to the support of repeating qualifiers in the typesafe resolution mechanism that is likely to be treated as part of the Java 8 stream of the CDI 2.0 specification.

              Unassigned Unassigned
              astefanu@redhat.com Antonin Stefanutti
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: