[ 
https://issues.apache.org/jira/browse/OWB-706?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mark Struberg closed OWB-706.
-----------------------------

> Interceptor bindings on methods that come from an interface with a generic 
> type may not work
> --------------------------------------------------------------------------------------------
>
>                 Key: OWB-706
>                 URL: https://issues.apache.org/jira/browse/OWB-706
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Interceptor and Decorators
>    Affects Versions: 1.1.5
>            Reporter: Joe Bergmark
>            Assignee: Joe Bergmark
>            Priority: Minor
>             Fix For: 1.2.0
>
>
> If you apply an interceptor binding to a method that implements an interface 
> that has a generic type, the interceptor might not be executed.
> I'll write some unit tests, but I think the scenario is something like the 
> following:
> public interface Foo<T>{
>   public void doSomething<T>
> }
> public class Bar implements Foo<String>{
>   @MyInterceptorBinding
>   public void doSomething<String>
> }
> When a contextual reference of Bar is cast to Foo, or even to Foo<String>, 
> calls to doSomething are no longer intercepted.
> What seems to be happening is that due to type erasure, Bar really has to 
> implement Foo<Object>, so the JDK adds a bridge method doSomething(Object) to 
> Bar that under the covers just calls doSomething(String).  The handler 
> doesn't recognize that doSomething(Object) will call doSomething(String) and 
> therefore doesn't run the interceptor.
> While the problem is complex, I believe the solution is pretty easy (at least 
> for the Javassist case).  We can just add a check for bridge methods to the 
> new MethodFilter (probably rename it to something less specific than 
> FinalizeMethodFilter) so that doSomethign(String) will get called on the 
> proxy and we will properly run the interceptor then rather than passing the 
> call to doSomething(Object) down to the proxied instance.
> This problem goes back to version 1.0, and its a very edge case, so I don't 
> think it has to go into 1.1.6.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to