AOP synthetic warnings after Java 8 upgrade
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 AbstractMatcherMethod { @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 google-guice+unsubscr...@googlegroups.com. To post to this group, send email to google-guice@googlegroups.com. 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. For more options, visit https://groups.google.com/d/optout.
Re: AOP synthetic warnings after Java 8 upgrade
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 sark...@gmail.com 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 AbstractMatcherMethod { @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 google-guice+unsubscr...@googlegroups.com. To post to this group, send email to google-guice@googlegroups.com. 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=emailutm_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 google-guice+unsubscr...@googlegroups.com. To post to this group, send email to google-guice@googlegroups.com. 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.
Re: AOP synthetic warnings after Java 8 upgrade
Sorry, I should have been more clear. I added the !method.isSynthetic() to get rid of the warnings that started appearing after upgrading to Java 8. The same code running on Java 7 didn't match any synthetic methods, and I didn't need to filter them out. Something in Java 8 seems to be causing the issue, and I'm not using lamdas or anything Java 8 specific. It seems to be working fine now though with the extra synthetic check. -- 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 google-guice+unsubscr...@googlegroups.com. To post to this group, send email to google-guice@googlegroups.com. 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/b3e9a0e8-831d-4c1f-854d-29e460f9e7fe%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: AOP synthetic warnings after Java 8 upgrade
Yeah, Java 8 changed things so that if a bridge method is generated for a method with annotations, the annotations are copied to the bridge method. I assume that's what's going on here. On Wed Nov 05 2014 at 1:32:36 PM sark...@gmail.com wrote: Sorry, I should have been more clear. I added the !method.isSynthetic() to get rid of the warnings that started appearing after upgrading to Java 8. The same code running on Java 7 didn't match any synthetic methods, and I didn't need to filter them out. Something in Java 8 seems to be causing the issue, and I'm not using lamdas or anything Java 8 specific. It seems to be working fine now though with the extra synthetic check. -- 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 google-guice+unsubscr...@googlegroups.com. To post to this group, send email to google-guice@googlegroups.com. 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/b3e9a0e8-831d-4c1f-854d-29e460f9e7fe%40googlegroups.com https://groups.google.com/d/msgid/google-guice/b3e9a0e8-831d-4c1f-854d-29e460f9e7fe%40googlegroups.com?utm_medium=emailutm_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 google-guice+unsubscr...@googlegroups.com. To post to this group, send email to google-guice@googlegroups.com. 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/CAHJY%3Dp75BjPChEpHPdWzM%2B4F0xizmW%2B0DmEq5EyUpJxy9-8zMg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: AOP synthetic warnings after Java 8 upgrade
Yup, exactly. Glad we have that warning logged! sam On Wed Nov 05 2014 at 1:42:52 PM 'Colin Decker' via google-guice google-guice@googlegroups.com wrote: Yeah, Java 8 changed things so that if a bridge method is generated for a method with annotations, the annotations are copied to the bridge method. I assume that's what's going on here. On Wed Nov 05 2014 at 1:32:36 PM sark...@gmail.com wrote: Sorry, I should have been more clear. I added the !method.isSynthetic() to get rid of the warnings that started appearing after upgrading to Java 8. The same code running on Java 7 didn't match any synthetic methods, and I didn't need to filter them out. Something in Java 8 seems to be causing the issue, and I'm not using lamdas or anything Java 8 specific. It seems to be working fine now though with the extra synthetic check. -- 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 google-guice+unsubscr...@googlegroups.com. To post to this group, send email to google-guice@googlegroups.com. 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/b3e9a0e8-831d-4c1f-854d-29e460f9e7fe%40googlegroups.com https://groups.google.com/d/msgid/google-guice/b3e9a0e8-831d-4c1f-854d-29e460f9e7fe%40googlegroups.com?utm_medium=emailutm_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 google-guice+unsubscr...@googlegroups.com. To post to this group, send email to google-guice@googlegroups.com. 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/CAHJY%3Dp75BjPChEpHPdWzM%2B4F0xizmW%2B0DmEq5EyUpJxy9-8zMg%40mail.gmail.com https://groups.google.com/d/msgid/google-guice/CAHJY%3Dp75BjPChEpHPdWzM%2B4F0xizmW%2B0DmEq5EyUpJxy9-8zMg%40mail.gmail.com?utm_medium=emailutm_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 google-guice+unsubscr...@googlegroups.com. To post to this group, send email to google-guice@googlegroups.com. 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/CAJEBNUeyw7EV_1KH0CwFpxgGkqGMPDgTdS3Wh_ShV8hqisLjew%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.