Guice 2.0 AOP validation utility

53 views
Skip to first unread message

Robbie Vanbrabant

unread,
Sep 22, 2008, 12:43:40 PM9/22/08
to Jesse Wilson, google...@googlegroups.com, warp...@googlegroups.com
Hi all,

I just hacked together a small utility that inspect your bindings and prints out warnings when it finds "suspicious" AOP configurations, like:
- final methods that match a pattern
- private methods that match a pattern
- instance injection that matches a pattern
- static injection that matches a pattern
- interfaces or abstract classes that match a pattern

Guice AOP (currently) silently ignores these cases (because of technical limitations), so this is definitely something useful.

I expect this code to be slow when you have tons of interceptor bindings. From a theoretical perspective, it would be useful if the SPI could let us visit AOP matches, and not just the interceptor bindings.

Beyond that, there are also several more improvements possible to this code. For example, the output is not as readable as it could be, and does not link to its source bindings. When you have improvements, please do share them!

Enjoy
Robbie

ps: only works for explicit bindings, obviously
aop-validation.zip

limpb...@gmail.com

unread,
Sep 22, 2008, 8:59:28 PM9/22/08
to google-guice

Dude, this is fantastic. Makes me very happy
to see the Elements API is getting exercised.

I was thinking of changing visitConstructor()
on BindTargetVisitor to include the interceptors
in the arguments list - what do you think?

On Sep 22, 9:43 am, "Robbie Vanbrabant" <robbie.vanbrab...@gmail.com>
wrote:
>  aop-validation.zip
> 3KViewDownload
Reply all
Reply to author
Forward
0 new messages