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

Interceptor for overriden generic method is not invoked

XMLWordPrintable

      The following simplified code works with weld 2.4.5.Final and stopped working in weld 3.0.4.Final.

      public abstract class AbstractService<S extends SuperParam> {
          public S doSomething(final S param) {... }
      }
      
      public class CurrentService extends AbstractService<CurrentParam> {
          @Override
          @PreAuthorize
          public CurrentParam doSomething(final CurrentParam param) {... }
      }
      
      @PreAuthorize
      @Interceptor
      public class PreAuthorizeInterceptor {
          @AroundInvoke
          public Object intercept(final InvocationContext invocationContext) throws Exception {...}
      }
      
      public abstract class AbstractIndexController<S extends SuperParam> {
          public void doSomething() {
              // INTERCEPTION WORKING IN "weld 2" BUT NOT WORKING in "weld 3"
                  this.getCurrentService().doSomething(entity);    
          }
          public abstract AbstractService<S> getCurrentService();
      }
      
      @RequestScoped
      @Named
      public class IndexController extends AbstractIndexController<CurrentParam> {
          @Inject
          CurrentService currentService;
          @Override
          public AbstractService<CurrentParam> getCurrentService() {
              return this.currentService;
          }
      }
      

      The interception of the overriden generic method in CurrentService stopped working after upgrading from weld 2.4.5.Final to 3.0.4.Final. The problem seems to be the passing of the injected currentService from the IndexController to the parent class AbstractIndexController.

              manovotn Matěj Novotný
              javatesting John Smith (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: