-
Enhancement
-
Resolution: Done
-
Major
-
1.1.5.Final
-
None
According to WELD-568 bridge methods for covariant return types should not be intercepted.
However, bridge methods that have a different signature, e.g. by using generics, should be interceptable.
Consider the following case using generic EJB methods:
//base definitions public class BaseParam {} public interface BaseInterface<T extends BaseParam> { public void doSomething( T param); }
//extension and ejb public class SpecialParam extends BaseParam{} public interface SpecialService extends BaseInterface<SpecialParam> {} @Stateless @Local(SpecialService.class) @SomeCDIInterceptorBinding public class SpecialServiceImpl implements SpecialService { public void doSomething( SpecialParam param) {} }
//call in another EJB @EJB private SpecialService s; ... s.doSomething(new SpecialParam());
For this call the invocation context contains the method signature "SpecialServiceImpl.doSomething(BaseParam)" which is the bridge method generated due to the generic parameter.
However, the method "Beans.getInterceptableMethods(WeldClass)" ignores this method when registering the interceptor because it is a bridge method:
boolean businessMethod = !annotatedMethod.isStatic()
&& !annotatedMethod.isAnnotationPresent(Inject.class)
&& !annotatedMethod.getJavaMember().isBridge();
Due to this, calls to bridge methods within EJBs are not intercepted.
Possible solution:
Bridge methods are not ignored by default but are replaced by non-bridge methods having the same signature when the interceptable methods are collected. That should solve this issue as well as WELD-568.
- is blocked by
-
AS7-5626 Code for finding the 'real' method from a bridge method does not take method parameter changes into account
- Resolved