Author: limpbizkit
Date: Thu Feb 19 13:57:55 2009
New Revision: 852
Modified:
trunk/build.xml
trunk/extensions/assistedinject/test/com/google/inject/assistedinject/FactoryProvider2Test.java
trunk/src/com/google/inject/AbstractModule.java
trunk/src/com/google/inject/AbstractProcessor.java
trunk/src/com/google/inject/Binder.java
trunk/src/com/google/inject/ClassBindingImpl.java
trunk/src/com/google/inject/ConstructionProxy.java
trunk/src/com/google/inject/DefaultConstructionProxyFactory.java
trunk/src/com/google/inject/PrivateModule.java
trunk/src/com/google/inject/SingleMethodInjector.java
trunk/src/com/google/inject/internal/BytecodeGen.java
trunk/src/com/google/inject/internal/MoreTypes.java
trunk/src/com/google/inject/internal/StackTraceElements.java
trunk/src/com/google/inject/spi/ConstructorBinding.java
trunk/src/com/google/inject/spi/Elements.java
trunk/src/com/google/inject/spi/ModuleWriter.java
trunk/test/com/google/inject/AllTests.java
trunk/test/com/google/inject/ParentInjectorTest.java
trunk/test/com/google/inject/internal/LineNumbersTest.java
trunk/test/com/google/inject/spi/ElementsTest.java
Log:
Removing all ASM and cglib dependencies from the no_aop build of Guice.
We now remove those .jar files from the build package, and remove
references to them from our build in common.xml.
Some tests now fail because they're written to expect a specific class name
in the exception message, like:
"at com.google.inject.Foo.<init>(Foo.java:223)"
but without LineNumbers we show a message like:
"at com.google.inject.Foo.<init>(Unknown Source)"
These failures are annoying but not really a dealbreaker for me. I'd prefer
to have failing tests in the no-aop build than to not have test coverage
for line number inclusion.
Modified: trunk/build.xml
==============================================================================
--- trunk/build.xml (original)
+++ trunk/build.xml Thu Feb 19 13:57:55 2009
@@ -121,9 +121,21 @@
<mkdir dir="build/no_aop"/>
<munge todir="build/no_aop">
<fileset dir=".">
- <exclude name="build/**/*"/>
+ <!-- exclude generated files -->
+ <exclude name="build/**"/>
+ <exclude name="classes/**"/>
+ <exclude name="latest-api-diffs/**"/>
+ <exclude name="javadoc/**"/>
+ <exclude name="latest-javadoc/**"/>
+ <!-- exclude AOP-specific libraries -->
+ <exclude name="lib/aopalliance.jar"/>
+ <exclude name="lib/build/asm-*.jar"/>
+ <exclude name="lib/build/cglib-*.jar"/>
+ <!-- exclude AOP-specific classes -->
+ <exclude name="**/LineNumbers.java"/>
<exclude name="**/InterceptorBindingProcessor.java"/>
<exclude name="**/ProxyFactory.java"/>
+ <exclude name="**/ProxyFactoryTest.java"/>
<exclude name="**/InterceptorStackCallback.java"/>
<exclude name="**/InterceptorBinding.java"/>
<exclude name="**/MethodAspect.java"/>
@@ -134,6 +146,8 @@
</fileset>
<arg value="-DNO_AOP" />
</munge>
+ <replace file="build/no_aop/common.xml" token="<zipfileset
src="${common.basedir}/lib/build/asm-3.1.jar"/>" value=""/>
+ <replace file="build/no_aop/common.xml" token="<zipfileset
src="${common.basedir}/lib/build/cglib-2.2.1-snapshot.jar"/>"
value=""/>
</target>
<target name="clean.all"
Modified:
trunk/extensions/assistedinject/test/com/google/inject/assistedinject/FactoryProvider2Test.java
==============================================================================
---
trunk/extensions/assistedinject/test/com/google/inject/assistedinject/FactoryProvider2Test.java
(original)
+++
trunk/extensions/assistedinject/test/com/google/inject/assistedinject/FactoryProvider2Test.java
Thu Feb 19 13:57:55 2009
@@ -35,8 +35,6 @@
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import junit.framework.TestCase;
-import org.aopalliance.intercept.MethodInterceptor;
-import org.aopalliance.intercept.MethodInvocation;
public class FactoryProvider2Test extends TestCase {
@@ -613,8 +611,10 @@
/*if[AOP]*/
public void testMethodInterceptorsOnAssistedTypes() {
final AtomicInteger invocationCount = new AtomicInteger();
- final MethodInterceptor interceptor = new MethodInterceptor() {
- public Object invoke(MethodInvocation methodInvocation) throws
Throwable {
+ final org.aopalliance.intercept.MethodInterceptor interceptor
+ = new org.aopalliance.intercept.MethodInterceptor() {
+ public Object invoke(org.aopalliance.intercept.MethodInvocation
methodInvocation)
+ throws Throwable {
invocationCount.incrementAndGet();
return methodInvocation.proceed();
}
Modified: trunk/src/com/google/inject/AbstractModule.java
==============================================================================
--- trunk/src/com/google/inject/AbstractModule.java (original)
+++ trunk/src/com/google/inject/AbstractModule.java Thu Feb 19 13:57:55 2009
@@ -26,7 +26,6 @@
import com.google.inject.spi.TypeConverter;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
-import org.aopalliance.intercept.MethodInterceptor;
/**
* A support class for {...@link Module}s which reduces repetition and
results in
@@ -163,7 +162,7 @@
*/
protected void bindInterceptor(Matcher<? super Class<?>> classMatcher,
Matcher<? super Method> methodMatcher,
- MethodInterceptor... interceptors) {
+ org.aopalliance.intercept.MethodInterceptor... interceptors) {
binder.bindInterceptor(classMatcher, methodMatcher, interceptors);
}
/*end[AOP]*/
Modified: trunk/src/com/google/inject/AbstractProcessor.java
==============================================================================
--- trunk/src/com/google/inject/AbstractProcessor.java (original)
+++ trunk/src/com/google/inject/AbstractProcessor.java Thu Feb 19 13:57:55
2009
@@ -20,7 +20,6 @@
import com.google.inject.spi.Element;
import com.google.inject.spi.ElementVisitor;
import com.google.inject.spi.InjectionRequest;
-import com.google.inject.spi.InterceptorBinding;
import com.google.inject.spi.Message;
import com.google.inject.spi.PrivateElements;
import com.google.inject.spi.ProviderLookup;
@@ -77,7 +76,8 @@
}
/*if[AOP]*/
- public Boolean visitInterceptorBinding(InterceptorBinding
interceptorBinding) {
+ public Boolean visitInterceptorBinding(
+ com.google.inject.spi.InterceptorBinding interceptorBinding) {
return false;
}
/*end[AOP]*/
Modified: trunk/src/com/google/inject/Binder.java
==============================================================================
--- trunk/src/com/google/inject/Binder.java (original)
+++ trunk/src/com/google/inject/Binder.java Thu Feb 19 13:57:55 2009
@@ -24,7 +24,6 @@
import com.google.inject.spi.TypeConverter;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
-import org.aopalliance.intercept.MethodInterceptor;
/**
* Collects configuration information (primarily <i>bindings</i>) which
will be
@@ -199,7 +198,8 @@
* @param interceptors to bind
*/
void bindInterceptor(Matcher<? super Class<?>> classMatcher,
- Matcher<? super Method> methodMatcher, MethodInterceptor...
interceptors);
+ Matcher<? super Method> methodMatcher,
+ org.aopalliance.intercept.MethodInterceptor... interceptors);
/*end[AOP]*/
/**
Modified: trunk/src/com/google/inject/ClassBindingImpl.java
==============================================================================
--- trunk/src/com/google/inject/ClassBindingImpl.java (original)
+++ trunk/src/com/google/inject/ClassBindingImpl.java Thu Feb 19 13:57:55
2009
@@ -34,7 +34,6 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.aopalliance.intercept.MethodInterceptor;
class ClassBindingImpl<T> extends BindingImpl<T> implements
ConstructorBinding<T> {
@@ -71,7 +70,7 @@
}
/*if[AOP]*/
- public Map<Method, List<MethodInterceptor>> getMethodInterceptors() {
+ public Map<Method, List<org.aopalliance.intercept.MethodInterceptor>>
getMethodInterceptors() {
return
lateBoundConstructor.constructorInjector.constructionProxy.getMethodInterceptors();
}
/*end[AOP]*/
Modified: trunk/src/com/google/inject/ConstructionProxy.java
==============================================================================
--- trunk/src/com/google/inject/ConstructionProxy.java (original)
+++ trunk/src/com/google/inject/ConstructionProxy.java Thu Feb 19 13:57:55
2009
@@ -22,7 +22,6 @@
import java.lang.reflect.Method;
import java.util.List;
import java.util.Map;
-import org.aopalliance.intercept.MethodInterceptor;
/**
* Proxies calls to a {...@link java.lang.reflect.Constructor} for a class
@@ -52,6 +51,6 @@
/**
* Returns the interceptors applied to each method, in order of
invocation.
*/
- Map<Method, List<MethodInterceptor>> getMethodInterceptors();
+ Map<Method, List<org.aopalliance.intercept.MethodInterceptor>>
getMethodInterceptors();
/*end[AOP]*/
}
Modified: trunk/src/com/google/inject/DefaultConstructionProxyFactory.java
==============================================================================
--- trunk/src/com/google/inject/DefaultConstructionProxyFactory.java
(original)
+++ trunk/src/com/google/inject/DefaultConstructionProxyFactory.java Thu
Feb 19 13:57:55 2009
@@ -17,8 +17,8 @@
package com.google.inject;
import com.google.common.collect.ImmutableMap;
+import com.google.inject.internal.BytecodeGen;
import com.google.inject.internal.BytecodeGen.Visibility;
-import static com.google.inject.internal.BytecodeGen.newFastClass;
import com.google.inject.spi.InjectionPoint;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
@@ -26,9 +26,6 @@
import java.lang.reflect.Modifier;
import java.util.List;
import java.util.Map;
-import net.sf.cglib.reflect.FastClass;
-import net.sf.cglib.reflect.FastConstructor;
-import org.aopalliance.intercept.MethodInterceptor;
/**
* Default {...@link ConstructionProxyFactory} implementation. Simply invokes
the
@@ -43,13 +40,14 @@
@SuppressWarnings("unchecked") // the injection point is for a
constructor of T
final Constructor<T> constructor = (Constructor<T>)
injectionPoint.getMember();
- /*if[AOP]*/
// Use FastConstructor if the constructor is public.
if (Modifier.isPublic(constructor.getModifiers())) {
+ /*if[AOP]*/
return new ConstructionProxy<T>() {
Class<T> classToConstruct = constructor.getDeclaringClass();
- FastClass fastClass = newFastClass(classToConstruct,
Visibility.forMember(constructor));
- final FastConstructor fastConstructor =
fastClass.getConstructor(constructor);
+ final net.sf.cglib.reflect.FastConstructor fastConstructor
+ = BytecodeGen.newFastClass(classToConstruct,
Visibility.forMember(constructor))
+ .getConstructor(constructor);
@SuppressWarnings("unchecked")
public T newInstance(Object... arguments) throws
InvocationTargetException {
@@ -61,14 +59,13 @@
public Constructor<T> getConstructor() {
return constructor;
}
- public Map<Method, List<MethodInterceptor>>
getMethodInterceptors() {
+ public Map<Method,
List<org.aopalliance.intercept.MethodInterceptor>>
+ getMethodInterceptors() {
return ImmutableMap.of();
}
};
- }
- /*end[AOP]*/
-
- if (!Modifier.isPublic(constructor.getModifiers())) {
+ /*end[AOP]*/
+ } else {
constructor.setAccessible(true);
}
@@ -89,7 +86,8 @@
return constructor;
}
/*if[AOP]*/
- public Map<Method, List<MethodInterceptor>> getMethodInterceptors() {
+ public Map<Method, List<org.aopalliance.intercept.MethodInterceptor>>
+ getMethodInterceptors() {
return ImmutableMap.of();
}
/*end[AOP]*/
Modified: trunk/src/com/google/inject/PrivateModule.java
==============================================================================
--- trunk/src/com/google/inject/PrivateModule.java (original)
+++ trunk/src/com/google/inject/PrivateModule.java Thu Feb 19 13:57:55 2009
@@ -26,7 +26,6 @@
import com.google.inject.spi.TypeConverter;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
-import org.aopalliance.intercept.MethodInterceptor;
/**
* A module whose configuration information is hidden from its environment
by default. Only bindings
@@ -181,7 +180,8 @@
/*if[AOP]*/
protected final void bindInterceptor(Matcher<? super Class<?>>
classMatcher,
- Matcher<? super Method> methodMatcher, MethodInterceptor...
interceptors) {
+ Matcher<? super Method> methodMatcher,
+ org.aopalliance.intercept.MethodInterceptor... interceptors) {
binder.bindInterceptor(classMatcher, methodMatcher, interceptors);
}
/*end[AOP]*/
Modified: trunk/src/com/google/inject/SingleMethodInjector.java
==============================================================================
--- trunk/src/com/google/inject/SingleMethodInjector.java (original)
+++ trunk/src/com/google/inject/SingleMethodInjector.java Thu Feb 19
13:57:55 2009
@@ -18,8 +18,8 @@
import com.google.common.collect.ImmutableList;
import com.google.inject.InjectorImpl.MethodInvoker;
+import com.google.inject.internal.BytecodeGen;
import com.google.inject.internal.BytecodeGen.Visibility;
-import static com.google.inject.internal.BytecodeGen.newFastClass;
import com.google.inject.internal.Errors;
import com.google.inject.internal.ErrorsException;
import com.google.inject.internal.InternalContext;
@@ -27,8 +27,6 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
-import net.sf.cglib.reflect.FastClass;
-import net.sf.cglib.reflect.FastMethod;
/**
* Invokes an injectable method.
@@ -42,30 +40,39 @@
throws ErrorsException {
this.injectionPoint = injectionPoint;
final Method method = (Method) injectionPoint.getMember();
+ methodInvoker = createMethodInvoker(method);
+ parameterInjectors =
injector.getParametersInjectors(injectionPoint.getDependencies(), errors);
+ }
+
+ private MethodInvoker createMethodInvoker(final Method method) {
// We can't use FastMethod if the method is private.
int modifiers = method.getModifiers();
- if (Modifier.isPrivate(modifiers) || Modifier.isProtected(modifiers)) {
- method.setAccessible(true);
- methodInvoker = new MethodInvoker() {
- public Object invoke(Object target, Object... parameters)
- throws IllegalAccessException, InvocationTargetException {
- return method.invoke(target, parameters);
- }
- };
- } else {
- FastClass fastClass = newFastClass(method.getDeclaringClass(),
Visibility.forMember(method));
- final FastMethod fastMethod = fastClass.getMethod(method);
+ if (!Modifier.isPrivate(modifiers)
&& !Modifier.isProtected(modifiers)) {
+ /*if[AOP]*/
+ final net.sf.cglib.reflect.FastMethod fastMethod
+ = BytecodeGen.newFastClass(method.getDeclaringClass(),
Visibility.forMember(method))
+ .getMethod(method);
- methodInvoker = new MethodInvoker() {
+ return new MethodInvoker() {
public Object invoke(Object target, Object... parameters)
throws IllegalAccessException, InvocationTargetException {
return fastMethod.invoke(target, parameters);
}
};
+ /*end[AOP]*/
}
- parameterInjectors =
injector.getParametersInjectors(injectionPoint.getDependencies(), errors);
+ if (!Modifier.isPublic(modifiers)) {
+ method.setAccessible(true);
+ }
+
+ return new MethodInvoker() {
+ public Object invoke(Object target, Object... parameters)
+ throws IllegalAccessException, InvocationTargetException {
+ return method.invoke(target, parameters);
+ }
+ };
}
public InjectionPoint getInjectionPoint() {
Modified: trunk/src/com/google/inject/internal/BytecodeGen.java
==============================================================================
--- trunk/src/com/google/inject/internal/BytecodeGen.java (original)
+++ trunk/src/com/google/inject/internal/BytecodeGen.java Thu Feb 19
13:57:55 2009
@@ -24,15 +24,11 @@
import java.security.PrivilegedAction;
import java.util.Map;
import java.util.logging.Logger;
-import net.sf.cglib.core.DefaultNamingPolicy;
-import net.sf.cglib.core.NamingPolicy;
-import net.sf.cglib.proxy.Enhancer;
-import net.sf.cglib.reflect.FastClass;
/**
- * Utility methods for runtime code generation and class loading. We use
this stuff for faster
- * reflection ({...@link FastClass}), method interceptors ({...@link
Enhancer})
and to proxy circular
- * dependencies.
+ * Utility methods for runtime code generation and class loading. We use
this stuff for {...@link
+ * net.sf.cglib.reflect.FastClass faster reflection}, {...@link
net.sf.cglib.proxy.Enhancer method
+ * interceptors} and to proxy circular dependencies.
*
* <p>When loading classes, we need to be careful of:
* <ul>
@@ -68,15 +64,21 @@
private static final String GUICE_INTERNAL_PACKAGE
=
BytecodeGen.class.getName().replaceFirst("\\.internal\\..*$", ".internal");
+ /*if[AOP]*/
/** either "net.sf.cglib", or "com.google.inject.internal.cglib" */
private static final String CGLIB_PACKAGE
- = Enhancer.class.getName().replaceFirst("\\.cglib\\..*$", ".cglib");
+ =
net.sf.cglib.proxy.Enhancer.class.getName().replaceFirst("\\.cglib\\..*$",
".cglib");
- static final NamingPolicy NAMING_POLICY = new DefaultNamingPolicy() {
+ static final net.sf.cglib.core.NamingPolicy NAMING_POLICY
+ = new net.sf.cglib.core.DefaultNamingPolicy() {
@Override protected String getTag() {
return "ByGuice";
}
};
+ /*end[AOP]*/
+ /*if[NO_AOP]
+ private static final String CGLIB_PACKAGE = " "; // any string that's
illegal in a package name
+ end[NO_AOP]*/
/** Use "-Dguice.custom.loader=false" to disable custom classloading. */
static final boolean HOOK_ENABLED
@@ -136,8 +138,11 @@
return delegate;
}
- public static FastClass newFastClass(Class<?> type, Visibility
visibility) {
- FastClass.Generator generator = new FastClass.Generator();
+ /*if[AOP]*/
+ // use fully-qualified names so imports don't need preprocessor
statements
+ public static net.sf.cglib.reflect.FastClass newFastClass(Class<?> type,
Visibility visibility) {
+ net.sf.cglib.reflect.FastClass.Generator generator
+ = new net.sf.cglib.reflect.FastClass.Generator();
generator.setType(type);
if (visibility == Visibility.PUBLIC) {
generator.setClassLoader(getClassLoader(type));
@@ -147,8 +152,8 @@
return generator.create();
}
- public static Enhancer newEnhancer(Class<?> type, Visibility visibility)
{
- Enhancer enhancer = new Enhancer();
+ public static net.sf.cglib.proxy.Enhancer newEnhancer(Class<?> type,
Visibility visibility) {
+ net.sf.cglib.proxy.Enhancer enhancer = new
net.sf.cglib.proxy.Enhancer();
enhancer.setSuperclass(type);
enhancer.setUseFactory(false);
if (visibility == Visibility.PUBLIC) {
@@ -158,6 +163,7 @@
logger.fine("Loading " + type + " Enhancer with " +
enhancer.getClassLoader());
return enhancer;
}
+ /*end[AOP]*/
/**
* The required visibility of a user's class from a Guice-generated
class. Visibility of
Modified: trunk/src/com/google/inject/internal/MoreTypes.java
==============================================================================
--- trunk/src/com/google/inject/internal/MoreTypes.java (original)
+++ trunk/src/com/google/inject/internal/MoreTypes.java Thu Feb 19 13:57:55
2009
@@ -360,6 +360,7 @@
public static String memberKey(Member member) {
checkNotNull(member, "member");
+ /*if[AOP]*/
if (member instanceof MemberImpl) {
return ((MemberImpl) member).memberKey;
@@ -380,6 +381,10 @@
throw new IllegalArgumentException(
"Unsupported implementation class for Member, " +
member.getClass());
}
+ /*end[AOP]*/
+ /*if[NO_AOP]
+ return "<NO_MEMBER_KEY>";
+ end[NO_AOP]*/
}
/**
Modified: trunk/src/com/google/inject/internal/StackTraceElements.java
==============================================================================
--- trunk/src/com/google/inject/internal/StackTraceElements.java
(original)
+++ trunk/src/com/google/inject/internal/StackTraceElements.java Thu Feb
19
13:57:55 2009
@@ -28,6 +28,7 @@
*/
public class StackTraceElements {
+ /*if[AOP]*/
static final Map<Class<?>, LineNumbers> lineNumbersCache = new
MapMaker().weakKeys().softValues()
.makeComputingMap(new Function<Class<?>, LineNumbers>() {
public LineNumbers apply(Class<?> key) {
@@ -39,6 +40,7 @@
}
}
});
+ /*end[AOP]*/
public static Object forMember(Member member) {
if (member == null) {
@@ -46,22 +48,34 @@
}
Class declaringClass = member.getDeclaringClass();
- LineNumbers lineNumbers = lineNumbersCache.get(declaringClass);
- Integer lineNumber = lineNumbers.getLineNumber(member);
- Class<? extends Member> memberType = MoreTypes.memberType(member);
+ /*if[AOP]*/
+ LineNumbers lineNumbers = lineNumbersCache.get(declaringClass);
+ String fileName = lineNumbers.getSource();
+ Integer lineNumberOrNull = lineNumbers.getLineNumber(member);
+ int lineNumber = lineNumberOrNull == null ?
lineNumbers.getFirstLine() : lineNumberOrNull;
+ /*end[AOP]*/
+ /*if[NO_AOP]
+ String fileName = null;
+ int lineNumber = -1;
+ end[NO_AOP]*/
+ Class<? extends Member> memberType = MoreTypes.memberType(member);
String memberName = memberType == Constructor.class ? "<init>" :
member.getName();
- return new StackTraceElement(declaringClass.getName(), memberName,
lineNumbers.getSource(),
- lineNumber == null ? lineNumbers.getFirstLine() : lineNumber);
+ return new StackTraceElement(declaringClass.getName(), memberName,
fileName, lineNumber);
}
public static Object forType(Class<?> implementation) {
+ /*if[AOP]*/
LineNumbers lineNumbers = lineNumbersCache.get(implementation);
- return new StackTraceElement(
- implementation.getName(),
- "class",
- lineNumbers.getSource(),
- lineNumbers.getFirstLine());
+ int lineNumber = lineNumbers.getFirstLine();
+ String fileName = lineNumbers.getSource();
+ /*end[AOP]*/
+ /*if[NO_AOP]
+ String fileName = null;
+ int lineNumber = -1;
+ end[NO_AOP]*/
+
+ return new StackTraceElement(implementation.getName(), "class",
fileName, lineNumber);
}
}
Modified: trunk/src/com/google/inject/spi/ConstructorBinding.java
==============================================================================
--- trunk/src/com/google/inject/spi/ConstructorBinding.java (original)
+++ trunk/src/com/google/inject/spi/ConstructorBinding.java Thu Feb 19
13:57:55 2009
@@ -22,7 +22,6 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.aopalliance.intercept.MethodInterceptor;
/**
* A binding to the constructor of a concrete clss. To resolve injections,
an instance is
@@ -51,7 +50,7 @@
*
* @return a possibly empty map
*/
- Map<Method, List<MethodInterceptor>> getMethodInterceptors();
+ Map<Method, List<org.aopalliance.intercept.MethodInterceptor>>
getMethodInterceptors();
/*end[AOP]*/
}
Modified: trunk/src/com/google/inject/spi/Elements.java
==============================================================================
--- trunk/src/com/google/inject/spi/Elements.java (original)
+++ trunk/src/com/google/inject/spi/Elements.java Thu Feb 19 13:57:55 2009
@@ -50,7 +50,6 @@
import java.util.Collections;
import java.util.List;
import java.util.Set;
-import org.aopalliance.intercept.MethodInterceptor;
/**
* Exposes elements of a module so they can be inspected, validated or
{...@link ModuleWriter
@@ -160,7 +159,7 @@
public void bindInterceptor(
Matcher<? super Class<?>> classMatcher,
Matcher<? super Method> methodMatcher,
- MethodInterceptor... interceptors) {
+ org.aopalliance.intercept.MethodInterceptor... interceptors) {
elements.add(new InterceptorBinding(getSource(), classMatcher,
methodMatcher, interceptors));
}
/*end[AOP]*/
Modified: trunk/src/com/google/inject/spi/ModuleWriter.java
==============================================================================
--- trunk/src/com/google/inject/spi/ModuleWriter.java (original)
+++ trunk/src/com/google/inject/spi/ModuleWriter.java Thu Feb 19 13:57:55
2009
@@ -30,7 +30,6 @@
import java.lang.annotation.Annotation;
import java.util.List;
import java.util.Map;
-import org.aopalliance.intercept.MethodInterceptor;
/**
* Creates a Module from a collection of component elements.
@@ -121,10 +120,10 @@
/*if[AOP]*/
protected void writeBindInterceptor(Binder binder, InterceptorBinding
element) {
- List<MethodInterceptor> interceptors = element.getInterceptors();
+ List<org.aopalliance.intercept.MethodInterceptor> interceptors =
element.getInterceptors();
binder.withSource(element.getSource()).bindInterceptor(
element.getClassMatcher(), element.getMethodMatcher(),
- interceptors.toArray(new MethodInterceptor[interceptors.size()]));
+ interceptors.toArray(new
org.aopalliance.intercept.MethodInterceptor[interceptors.size()]));
}
/*end[AOP]*/
Modified: trunk/test/com/google/inject/AllTests.java
==============================================================================
--- trunk/test/com/google/inject/AllTests.java (original)
+++ trunk/test/com/google/inject/AllTests.java Thu Feb 19 13:57:55 2009
@@ -32,7 +32,6 @@
import com.google.inject.spi.SpiBindingsTest;
import com.google.inject.util.ProvidersTest;
import com.google.inject.util.TypesTest;
-import com.googlecode.guice.BytecodeGenTest;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -70,7 +69,6 @@
suite.addTestSuite(PrivateModuleTest.class);
suite.addTestSuite(ProviderInjectionTest.class);
suite.addTestSuite(ProvisionExceptionTest.class);
- suite.addTestSuite(ProxyFactoryTest.class);
suite.addTestSuite(ReflectionTest.class);
suite.addTestSuite(ScopesTest.class);
suite.addTestSuite(SerializationTest.class);
@@ -109,9 +107,10 @@
suite.addTestSuite(ProvidersTest.class);
/*if[AOP]*/
+ suite.addTestSuite(ProxyFactoryTest.class);
suite.addTestSuite(IntegrationTest.class);
suite.addTestSuite(MethodInterceptionTest.class);
- suite.addTestSuite(BytecodeGenTest.class);
+ suite.addTestSuite(com.googlecode.guice.BytecodeGenTest.class);
/*end[AOP]*/
return suite;
Modified: trunk/test/com/google/inject/ParentInjectorTest.java
==============================================================================
--- trunk/test/com/google/inject/ParentInjectorTest.java (original)
+++ trunk/test/com/google/inject/ParentInjectorTest.java Thu Feb 19
13:57:55 2009
@@ -27,8 +27,6 @@
import java.lang.annotation.Target;
import java.util.List;
import junit.framework.TestCase;
-import org.aopalliance.intercept.MethodInterceptor;
-import org.aopalliance.intercept.MethodInvocation;
/**
* @author [email protected] (Jesse Wilson)
@@ -111,6 +109,13 @@
}
/*if[AOP]*/
+ private final org.aopalliance.intercept.MethodInterceptor
returnNullInterceptor
+ = new org.aopalliance.intercept.MethodInterceptor() {
+ public Object invoke(org.aopalliance.intercept.MethodInvocation
methodInvocation) {
+ return null;
+ }
+ };
+
public void testInterceptorsInherited() {
Injector parent = Guice.createInjector(new AbstractModule() {
protected void configure() {
@@ -210,12 +215,6 @@
@Target(TYPE) @Retention(RUNTIME) @ScopeAnnotation
public @interface MyScope {}
-
- private final MethodInterceptor returnNullInterceptor = new
MethodInterceptor() {
- public Object invoke(MethodInvocation methodInvocation) throws
Throwable {
- return null;
- }
- };
private final TypeConverter listConverter = new TypeConverter() {
public Object convert(String value, TypeLiteral<?> toType) {
Modified: trunk/test/com/google/inject/internal/LineNumbersTest.java
==============================================================================
--- trunk/test/com/google/inject/internal/LineNumbersTest.java (original)
+++ trunk/test/com/google/inject/internal/LineNumbersTest.java Thu Feb 19
13:57:55 2009
@@ -24,8 +24,6 @@
import com.google.inject.Inject;
import com.google.inject.matcher.Matchers;
import junit.framework.TestCase;
-import org.aopalliance.intercept.MethodInterceptor;
-import org.aopalliance.intercept.MethodInvocation;
/**
* @author [email protected] (Jesse Wilson)
@@ -38,8 +36,8 @@
Guice.createInjector(new AbstractModule() {
protected void configure() {
bindInterceptor(Matchers.only(A.class), Matchers.any(),
- new MethodInterceptor() {
- public Object invoke(MethodInvocation methodInvocation) {
+ new org.aopalliance.intercept.MethodInterceptor() {
+ public Object
invoke(org.aopalliance.intercept.MethodInvocation methodInvocation) {
return null;
}
});
Modified: trunk/test/com/google/inject/spi/ElementsTest.java
==============================================================================
--- trunk/test/com/google/inject/spi/ElementsTest.java (original)
+++ trunk/test/com/google/inject/spi/ElementsTest.java Thu Feb 19 13:57:55
2009
@@ -52,8 +52,6 @@
import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicInteger;
import junit.framework.TestCase;
-import org.aopalliance.intercept.MethodInterceptor;
-import org.aopalliance.intercept.MethodInvocation;
/**
* @author [email protected] (Jesse Wilson)
@@ -543,8 +541,9 @@
public void testBindIntercepor() {
final Matcher<Class> classMatcher = Matchers.subclassesOf(List.class);
final Matcher<Object> methodMatcher = Matchers.any();
- final MethodInterceptor methodInterceptor = new MethodInterceptor() {
- public Object invoke(MethodInvocation methodInvocation) {
+ final org.aopalliance.intercept.MethodInterceptor methodInterceptor
+ = new org.aopalliance.intercept.MethodInterceptor() {
+ public Object invoke(org.aopalliance.intercept.MethodInvocation
methodInvocation) {
return null;
}
};
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---