3 Replies Latest reply on Apr 13, 2010 4:27 AM by mbogoevici

    Decorating parameterized extended interfaces

    icarus1111

      Hello,


      I'm having deployment troubles when I use a decorated interface which is parameterized by it's parent. For example:


      public interface Dao<K extends Serializable, E> {
      
           public E find(K id);
      
      }
      



      public interface AccountDao extends Dao<Integer, Account> {
           
           public Account findByDeposit(String deposit);
      
      }
      



      public class AccountDaoJpa implements AccountDao {
      
           @Override
           public Account find(Integer id) {
                return null;
           }
      
           @Override
           public Account findByDeposit(String deposit) {
                return null;
           }
      
      }
      



      @Decorator
      public class AccountDaoDecorator implements AccountDao {
           
           @Inject @Delegate @Any AccountDao accountDao;
      
           @Override
           public Account find(Integer id) {
                return null;
           }
      
           @Override
           public Account findByDeposit(String deposit) {
                return null;
           }
      
      }



      will result in a


      WELD-000062 The decorated type is parameterized, but the delegate type isnt.  Delegate type {0} on {1}


      deployment error.


      When I modify public interface AccountDao extends Dao<Integer, Account> into public interface AccountDao the deployment will finish just fine.


      Aren't decorators suppose to work with parameterized extended interfaces, or am I doing something wrong?


      Ramon