Revision: 1304
Author: mcculls
Date: Thu Oct 21 15:05:58 2010
Log: Issue 561: fix no_aop build by munging away all aop-related references
http://code.google.com/p/google-guice/source/detail?r=1304
Modified:
/trunk/core/src/com/google/inject/internal/ConstructionProxy.java
/trunk/core/src/com/google/inject/internal/DefaultConstructionProxyFactory.java
/trunk/core/test/com/google/inject/AllTests.java
/trunk/core/test/com/google/inject/BindingTest.java
/trunk/core/test/com/google/inject/internal/util/LineNumbersTest.java
/trunk/core/test/com/google/inject/spi/ElementsTest.java
/trunk/core/test/com/googlecode/guice/OSGiContainerTest.java
/trunk/core/test/com/googlecode/guice/bundle/OSGiTestActivator.java
=======================================
--- /trunk/core/src/com/google/inject/internal/ConstructionProxy.java Sat
Jul 3 08:51:31 2010
+++ /trunk/core/src/com/google/inject/internal/ConstructionProxy.java Thu
Oct 21 15:05:58 2010
@@ -22,7 +22,6 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
-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.
*/
- ImmutableMap<Method, List<MethodInterceptor>> getMethodInterceptors();
+ ImmutableMap<Method, List<org.aopalliance.intercept.MethodInterceptor>>
getMethodInterceptors();
/*end[AOP]*/
}
=======================================
---
/trunk/core/src/com/google/inject/internal/DefaultConstructionProxyFactory.java
Sat Jul 3 08:51:31 2010
+++
/trunk/core/src/com/google/inject/internal/DefaultConstructionProxyFactory.java
Thu Oct 21 15:05:58 2010
@@ -24,7 +24,6 @@
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.List;
-import org.aopalliance.intercept.MethodInterceptor;
/**
* Produces construction proxies that invoke the class constructor.
@@ -97,7 +96,7 @@
return constructor;
}
/*if[AOP]*/
- public ImmutableMap<Method, List<MethodInterceptor>>
+ public ImmutableMap<Method,
List<org.aopalliance.intercept.MethodInterceptor>>
getMethodInterceptors() {
return ImmutableMap.of();
}
=======================================
--- /trunk/core/test/com/google/inject/AllTests.java Sat Jul 3 08:51:31
2010
+++ /trunk/core/test/com/google/inject/AllTests.java Thu Oct 21 15:05:58
2010
@@ -22,7 +22,6 @@
import com.google.inject.internal.util.LineNumbersTest;
import com.google.inject.internal.util.MapMakerTestSuite;
import com.google.inject.internal.MoreTypesTest;
-import com.google.inject.internal.ProxyFactoryTest;
import com.google.inject.internal.UniqueAnnotationsTest;
import com.google.inject.matcher.MatcherTest;
import com.google.inject.name.NamedEquivalanceTest;
@@ -138,7 +137,7 @@
suite.addTestSuite(TypesTest.class);
/*if[AOP]*/
- suite.addTestSuite(ProxyFactoryTest.class);
+ suite.addTestSuite(com.google.inject.internal.ProxyFactoryTest.class);
suite.addTestSuite(IntegrationTest.class);
suite.addTestSuite(MethodInterceptionTest.class);
suite.addTestSuite(com.googlecode.guice.BytecodeGenTest.class);
=======================================
--- /trunk/core/test/com/google/inject/BindingTest.java Sat Jul 3 08:51:31
2010
+++ /trunk/core/test/com/google/inject/BindingTest.java Thu Oct 21 15:05:58
2010
@@ -33,8 +33,10 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Logger;
import junit.framework.TestCase;
+/*if[AOP]*/
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
+/*end[AOP]*/
/**
* @author [email protected] (Bob Lee)
@@ -275,6 +277,7 @@
}
}
+/*if[AOP]*/
public void testToConstructorAndMethodInterceptors() throws
NoSuchMethodException {
final Constructor<D> constructor = D.class.getConstructor(Stage.class);
final AtomicInteger count = new AtomicInteger();
@@ -297,6 +300,7 @@
d.hashCode();
assertEquals(2, count.get());
}
+/*end[AOP]*/
public void testInaccessibleConstructor() throws NoSuchMethodException {
final Constructor<E> constructor =
E.class.getDeclaredConstructor(Stage.class);
=======================================
--- /trunk/core/test/com/google/inject/internal/util/LineNumbersTest.java
Sat Jul 3 08:51:31 2010
+++ /trunk/core/test/com/google/inject/internal/util/LineNumbersTest.java
Thu Oct 21 15:05:58 2010
@@ -29,6 +29,22 @@
*/
public class LineNumbersTest extends TestCase {
+ public void testLineNumbers() {
+ try {
+ Guice.createInjector(new AbstractModule() {
+ protected void configure() {
+ bind(A.class);
+ }
+ });
+ fail();
+ } catch (CreationException expected) {
+ assertContains(expected.getMessage(),
+ "1) No implementation for " + B.class.getName() + " was bound.",
+ "for parameter 0 at " + A.class.getName()
+ ".<init>(LineNumbersTest.java:",
+ "at " +
LineNumbersTest.class.getName(), ".configure(LineNumbersTest.java:");
+ }
+ }
+
/*if[AOP]*/
public void testCanHandleLineNumbersForGuiceGeneratedClasses() {
try {
=======================================
--- /trunk/core/test/com/google/inject/spi/ElementsTest.java Sat Jul 3
08:51:31 2010
+++ /trunk/core/test/com/google/inject/spi/ElementsTest.java Thu Oct 21
15:05:58 2010
@@ -1127,7 +1127,9 @@
assertEquals(field,
getOnlyElement(constructorBinding.getInjectableMembers()).getMember());
assertEquals(2,
constructorBinding.getDependencies().size());
+/*if[AOP]*/
assertEquals(ImmutableMap.of(),
constructorBinding.getMethodInterceptors());
+/*end[AOP]*/
return null;
}
});
=======================================
--- /trunk/core/test/com/googlecode/guice/OSGiContainerTest.java Sun May 9
05:48:24 2010
+++ /trunk/core/test/com/googlecode/guice/OSGiContainerTest.java Thu Oct 21
15:05:58 2010
@@ -53,7 +53,9 @@
static final String GUICE_JAR = BUILD_DIST_DIR + "/guice-" + VERSION
+ ".jar";
+/*if[AOP]*/
static final String AOPALLIANCE_JAR =
System.getProperty("aopalliance.jar", "lib/aopalliance.jar");
+/*end[AOP]*/
static final String JAVAX_INJECT_JAR =
System.getProperty("javax.inject.jar", "lib/javax.inject.jar");
// dynamically build test bundles
@@ -64,15 +66,19 @@
assertTrue(failMsg(), new File(BUILD_DIR).isDirectory());
assertTrue(failMsg(), new File(GUICE_JAR).isFile());
+/*if[AOP]*/
assertTrue(failMsg(), new File(AOPALLIANCE_JAR).isFile());
+/*end[AOP]*/
assertTrue(failMsg(), new File(JAVAX_INJECT_JAR).isFile());
Properties instructions = new Properties();
+/*if[AOP]*/
// aopalliance is an API bundle --> export the full API
instructions.setProperty("Export-Package", "org.aopalliance.*");
buildBundle("aopalliance", instructions, AOPALLIANCE_JAR);
instructions.clear();
+/*end[AOP]*/
// javax.inject is an API bundle --> export the full API
instructions.setProperty("Export-Package", "javax.inject.*");
@@ -80,7 +86,10 @@
instructions.clear();
// strict imports to make sure test bundle only has access to these
packages
-
instructions.setProperty("Import-Package", "org.osgi.framework,org.aopalliance.intercept,"
+ instructions.setProperty("Import-Package", "org.osgi.framework,"
+/*if[AOP]*/
+ + "org.aopalliance.intercept,"
+/*end[AOP]*/
+ "com.google.inject(|.binder|.matcher|.name)");
// test bundle should only contain the local test classes, nothing else
@@ -130,7 +139,9 @@
BundleContext systemContext = framework.getBundleContext();
// load all the necessary bundles and start the OSGi test bundle
+/*if[AOP]*/
systemContext.installBundle("reference:file:" + BUILD_TEST_DIR
+ "/aopalliance.jar");
+/*end[AOP]*/
systemContext.installBundle("reference:file:" + BUILD_TEST_DIR
+ "/javax.inject.jar");
systemContext.installBundle("reference:file:" + GUICE_JAR);
systemContext.installBundle("reference:file:" + BUILD_TEST_DIR
+ "/osgitests.jar").start();
=======================================
--- /trunk/core/test/com/googlecode/guice/bundle/OSGiTestActivator.java Sun
May 9 05:48:24 2010
+++ /trunk/core/test/com/googlecode/guice/bundle/OSGiTestActivator.java Thu
Oct 21 15:05:58 2010
@@ -22,8 +22,6 @@
import java.lang.reflect.Modifier;
import java.util.Random;
-import org.aopalliance.intercept.MethodInterceptor;
-import org.aopalliance.intercept.MethodInvocation;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
@@ -469,8 +467,8 @@
return (methodModifiers & (Modifier.PUBLIC |
Modifier.PROTECTED)) != 0;
}
- }, new MethodInterceptor() {
- public Object invoke(MethodInvocation mi)
+ }, new org.aopalliance.intercept.MethodInterceptor() {
+ public Object invoke(org.aopalliance.intercept.MethodInvocation mi)
throws Throwable {
return mi.proceed();
--
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.