Revision: 1501
Author: sberlin
Date: Sun Feb 20 13:39:07 2011
Log: add some logging for interceptors that may trigger issue 252.
http://code.google.com/p/google-guice/source/detail?r=1501

Modified:
 /trunk/core/src/com/google/inject/internal/ProxyFactory.java

=======================================
--- /trunk/core/src/com/google/inject/internal/ProxyFactory.java Tue Jan 18 11:41:12 2011 +++ /trunk/core/src/com/google/inject/internal/ProxyFactory.java Sun Feb 20 13:39:07 2011
@@ -16,7 +16,6 @@

 package com.google.inject.internal;

-import com.google.inject.ProvisionException;
 import static com.google.inject.internal.BytecodeGen.newFastClass;
 import com.google.inject.internal.util.ImmutableList;
 import com.google.inject.internal.util.ImmutableMap;
@@ -27,13 +26,14 @@
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
 import net.sf.cglib.proxy.Callback;
 import net.sf.cglib.proxy.CallbackFilter;
 import net.sf.cglib.proxy.Enhancer;
-import net.sf.cglib.proxy.MethodProxy;
 import net.sf.cglib.reflect.FastClass;
 import net.sf.cglib.reflect.FastConstructor;
 import org.aopalliance.intercept.MethodInterceptor;
@@ -45,6 +45,8 @@
  * @author [email protected] (Jesse Wilson)
  */
 final class ProxyFactory<T> implements ConstructionProxyFactory<T> {
+
+ private static final Logger logger = Logger.getLogger(ProxyFactory.class.getName());

   private final InjectionPoint injectionPoint;
   private final ImmutableMap<Method, List<MethodInterceptor>> interceptors;
@@ -95,6 +97,13 @@
     for (MethodAspect methodAspect : applicableAspects) {
       for (MethodInterceptorsPair pair : methodInterceptorsPairs) {
         if (methodAspect.matches(pair.method)) {
+          if(pair.method.isSynthetic()) {
+            logger.log(Level.WARNING,
+ "Method [{0}] is synthetic and is being intercepted by {1}." + + " This could indicate a bug. The method may be intercepted twice,"
+              + " or may not be intercepted at all.",
+                new Object[] { pair.method, methodAspect.interceptors() });
+          }
visibility = visibility.and(BytecodeGen.Visibility.forMember(pair.method));
           pair.addAll(methodAspect.interceptors());
           anyMatched = true;

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice-dev?hl=en.

Reply via email to