0 Replies Latest reply on Jul 24, 2015 4:07 AM by julian8628

    Problem of inheritance for initializer(injecting method)

    julian8628

      I'm facing an issue like this:

      What is the member type in @Override method of sub-class

      for example:

      public interface Dao {}
      @Typed(A.class)
      public class A implements Dao {}
      @Typed(B.class)
      public class B extends A {}
      
      public class X<T> {
      
          private T dao;
      
          public void set(T dao) {
              this.dao = dao;
          }
      
      }
      
      public class Y extends X<A> {
          @Override
          @Inject
          public void set(A a) {
              super.set(a);
          }
      }
      
      public class Z extend X<B> {
          @Override
          @Inject
          public void set(B b) {
              super.set(b)
          }
      }
      

       

      The question is what the type of A Weld checked at set() of Y and Z when initializing? Dao or A,B?

      on EAP 6.2.0, If I build it in local maven, there's no error when Jboss initializing. That means it will be treated as Sub-class

      But if I build it in Koji brew maven, it will be treated as Dao, and Unsatisfied dependencies error occurs.