bineanzhou / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 0 forks source link

Interceptor ineffective on private method #192

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
*Description*
When using interceptor on private method such as:

@Transactional
private dosomething(){}

the interception is not performed.

This is understandable as the method inside interception class could not be
able to call a private method.

*Problem*

You are never warned about the ineffectiveness of the annotation. 
So you might think everything is going ok ;)

*Suggestion*

Check at injection or binding stage that interception annotations are not
set on private methods.

Original issue reported on code.google.com by alexis.a...@gmail.com on 16 Apr 2008 at 4:14

GoogleCodeExporter commented 9 years ago
This is actually more difficult than it could be. The problem is that 
user-supplied matchers decide whether a 
method should be included. Matcher A uses annotations, but matcher B just 
matches all methods.

We've set ourselves up so that we can't cleanly distinguish between these two 
cases. In case A, matching a 
private method justifies a warning. In case B, it's no big deal.

We could possibly maybe use some instanceof magic to check for Guice's 
annotation matcher, but it doesn't 
work well in general 'cause matchers are composable. Regrettably I don't think 
we can fix this one cleanly on 
the current API. 

If you've got an idea for a clean fix, please reopen.

Original comment by limpbizkit on 14 May 2008 at 3:20