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

Interceptor for generic method with generic implementation is not invoked

XMLWordPrintable

      public interface BaseService<T> {
          void setSomething(T param);
      
          T getSomething();
      }
      
      public abstract class BaseServiceImpl<T> implements BaseService<T> {
          @Override
          public void setSomething(T param) {
          }
      
          @Override
          public T getSomething() {
              return null;
          }
      }
      
      public interface SpecialService extends BaseService<String> {
          @Override
          // for declaring some special annotations
          void setSomething(String param);
      
          @Override
          String getSomething();
      }
      
      @SomeInterceptorBinding
      public class ManagedSpecialServiceImpl extends BaseServiceImpl<String> implements SpecialService {
      }
      
      @Stateless
      @Local(SpecialService.class)
      @SomeInterceptorBinding
      public class EJBSpecialServiceImpl extends BaseServiceImpl<String> implements SpecialService {
      }
      
      1. getSomething() - interceptor is not invoked at all.
      2. Injecting ManagedSpecialServiceImpl as SpecialService - for setSomethig() interceptor is not invoked, moreover setSomethig(Sting) of Weld proxy is bridge method of ManagedSpecialServiceImpl that direct call BaseServiceImpl#setSomethig(Object), so in BaseServiceImpl#setSomethig(Object) we have this = Weld proxy.
      3. Not reproduced by attached testcase, but in my application, for EJB injection interceptor for setSomethig() also is not invoked.

              mkouba@redhat.com Martin Kouba
              avdot Alexander Korsukov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: