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

Support type annotation in assignability of parameterized types

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Obsolete
    • Major
    • None
    • None
    • Resolution
    • None

    Description

      Since Java 8 provides support for type annotations, the assignability of parameterized types rules could be updated to support that feature that may add value in a number of use cases.

      For example, with lifecycle events resolution, instead of writing:

      Set<Annotation> contextNames = new HashSet<>();
      
      void camelContextNames(@Observes ProcessAnnotatedType<? extends CamelContext> pat) {
          if (pat.getAnnotatedType().isAnnotationPresent(ContextName.class))
              contextNames.add(pat.getAnnotatedType().getAnnotation(ContextName.class));
      }
      

      One could directly write:

      void camelContextNames(@Observes ProcessAnnotatedType<@ContextName ? extends CamelContext> pat) {
          contextNames.add(pat.getAnnotatedType().getAnnotation(ContextName.class));
      }
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: