add some logging for interceptors that may trigger issue 252.
git-svn-id: https://google-guice.googlecode.com/svn/trunk@1501 d779f126-a31b-0410-b53b-1d3aecad763e
diff --git a/core/src/com/google/inject/internal/ProxyFactory.java b/core/src/com/google/inject/internal/ProxyFactory.java
index 28020b2..97c3893 100644
--- a/core/src/com/google/inject/internal/ProxyFactory.java
+++ b/core/src/com/google/inject/internal/ProxyFactory.java
@@ -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 jessewilson@google.com (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;