Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-811

Hierarchy injection is not working with external annotation type.

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Major
    • Resolution: Done
    • 1.1.0.CR3
    • 1.1.2.Final
    • Weld SPI
    • None
    • Hide

      Create an extension wrapping an annotation type in class using injected fields (or methods) of its superclass.

      class Foo {
      @Inject BeanManager beanManager;
      }

      class Bar extends Foo {
      // beanManager will be null.
      }

      public <T> void processAnnotatedType(@Observes ProcessAnnotatedType<T> pat) {
      AnnotatedType<T> w = wrapAnnotatedType(pat.getAnnotatedType());
      pat.setAnnotatedType(w);
      }

      Show
      Create an extension wrapping an annotation type in class using injected fields (or methods) of its superclass. class Foo { @Inject BeanManager beanManager; } class Bar extends Foo { // beanManager will be null. } public <T> void processAnnotatedType(@Observes ProcessAnnotatedType<T> pat) { AnnotatedType<T> w = wrapAnnotatedType(pat.getAnnotatedType()); pat.setAnnotatedType(w); }

    Description

      In WeldClassImpl constructor, superclass is set as an Object.class when annotatedType is instanceof ExternalAnnotatedType (discovered flag). Why?
      This behavior causes a non injection of superclasses fields and methods. Is this correct ?

      Attachments

        Activity

          People

            sdouglas1@redhat.com Stuart Douglas
            rogerio.baldini_jira Rogerio Baldini (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: