Issue Type: Enhancement Enhancement
Affects Versions: 1.1.5.Final
Assignee: Unassigned
Components: Interceptors and Decorators
Created: 10/Jul/12 7:47 AM
Description:

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.

Environment: JBoss 7.1.0.Final
Project: Weld
Priority: Major Major
Reporter: Thomas Goettlich
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira