google / google/guice

Bindings fails silenciously instead of raising exception on certains aop configuration

Open
#711 2 comments 0 reactions 0 assignees View on GitHub
imported
Dominant language
Java
Stars
12.7k
Forks
1.7k
Avg merge
11m
Merged PRs (30d)
2

Description

_From [taharqa](https://code.google.com/u/taharqa/) on June 06, 2012 12:56:23_

Description of the issue: I spent hours to figure out that putting interceptors around class that does not have any interface won't have the interceptor intercep nor the Binding mechanism indicate an error at least at runtime. Steps to reproduce: 1. Take the AOP sample https://code.google.com/p/google-guice/wiki/AOP 2. Remove "implements BillingService" to RealBillingService
3. Adapt the module to inject
// module code
        bind(RealBillingService.class).toInstance(new RealBillingService ());
        bindInterceptor(Matchers.any(), Matchers.annotatedWith(NotOnWeekends.class), new WeekendBlocker());

// Launcher code
Injector i = Guice.createInjector(new NotOnWeekendsModule());
        RealBillingService bs = i.getInstance(RealBillingService.class);        
        bs.chargeOrder("", ""); // <== here no interception, no error
1. Run and see no interception

Here we might at least an error or something runtime indicating no interception occurs.

_Original issue: http://code.google.com/p/google-guice/issues/detail?id=711_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.