This is indeed odd, especially because your matcher explicitly says no
synthetic methods.

There was a related change in Java8 where annotations now are copied to
generated bridge methods,  What happens if you add && !method.isBridge() to
the matcher (though that's unlikely to fix anything)?

FWIW, the code checking this is here
<https://github.com/google/guice/blob/2c80ab4257ba96e25ab658a3f4355f66a4fc48d0/core/src/com/google/inject/internal/ProxyFactory.java#L104>...
so
it's checking for synthetic methods. Guice issue 252
<https://github.com/google/guice/issues/252> has some background on this,
and there's a related change
<https://github.com/cglib/cglib/commit/df8bb42eda32c1ea645393750328fbaefe32cdf9>
in cglib to make this kind of pattern work.

Could you create an issue <https://github.com/google/guice/issues/new> with
a minimal test-case that reproduces the problem, and we can look into it?

Thanks!

sam




On Wed Nov 05 2014 at 8:15:59 AM <[email protected]> wrote:

> Recently after upgrading to Java 8 I've started to see warnings from guice
> AOP in my glassfish logs:
>
> [2014-11-05T13:18:01.197+0100] [glassfish 4.0] [WARNING] []
> [com.google.inject.internal.ProxyFactory] [tid: _ThreadID=19
> _ThreadName=http-listener-1(1)] [timeMillis: 1415189881197] [levelValue:
> 900] [[
>   Method [public com.gwtplatform.dispatch.rpc.shared.Result
> SendUserMessageHandler.execute(com.gwtplatform.dispatch.rpc.shared.Action)
> throws com.gwtplatform.dispatch.shared.ActionException] is synthetic and is
> being intercepted by [TransactionalInterceptor@3b17ed63]. This could
> indicate a bug.  The method may be intercepted twice, or may not be
> intercepted at all.]]
>
> I have a custom @Transaction annotation in subclasses of
> AbstractActionHandler. I've modified my code and the warnings are gone, but
> I'm concerned that there could be other issues as well. Do you know if
> there are any changes in java 8 which would cause these warnings to appear?
> The code didn't change at all between java 7 and 8 upgrade.
>
> My current code which excludes synthetic methods:
>
> public class ServerModule extends AbstractModule {
>     private static final class TransactionMethodMatcher extends
> AbstractMatcher<Method> {
>         @Override
>         public boolean matches(final Method method) {
>             return method.isAnnotationPresent(Transaction.class) && !
> method.isSynthetic();
>     }
>
>     @Override
>     protected final void configure() {
>         final TransactionalInterceptor transactionalInterceptor = new
> TransactionalInterceptor();
>
>         bindInterceptor(Matchers.subclassesOf(AbstractActionHandler.class
> ), new TransactionMethodMatcher(), transactionalInterceptor);
>         bind(TransactionalInterceptor.class).toInstance(
> transactionalInterceptor);
>         requestInjection(transactionalInterceptor);
>     }
> }
>
>  --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/google-guice.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-guice/5af71528-f8cb-41ae-9ac6-f09f02b955e6%40googlegroups.com
> <https://groups.google.com/d/msgid/google-guice/5af71528-f8cb-41ae-9ac6-f09f02b955e6%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-guice/CAJEBNUdRUOM3nXWcSgRSFtXO2ik6t9Qg68biGyb20e_wfuBAkg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to