Revision: 1507
Author: sberlin
Date: Thu Feb 24 06:49:01 2011
Log: make sure tests can run in on dist code, and no_aop can still build.
http://code.google.com/p/google-guice/source/detail?r=1507

Modified:
 /trunk/common.xml
 /trunk/core/test/com/google/inject/internal/util/LineNumbersTest.java

=======================================
--- /trunk/common.xml   Tue Dec 14 21:29:08 2010
+++ /trunk/common.xml   Thu Feb 24 06:49:01 2011
@@ -123,6 +123,10 @@
         classpath="${common.basedir}/lib/build/jarjar-snapshot.jar"/>
<jarjar jarfile="${build.dir}/${ant.project.name}-${version}-tests.jar">
       <fileset dir="${build.dir}/test"/>
+ <rule pattern="net.sf.cglib.*" result="com.google.inject.internal.cglib.$@1"/> + <rule pattern="net.sf.cglib.**.*" result="com.google.inject.internal.cglib.@1.$@2"/> + <rule pattern="org.objectweb.asm.*" result="com.google.inject.internal.asm.$@1"/> + <rule pattern="org.objectweb.asm.**.*" result="com.google.inject.internal.asm.@1.$@2"/> <rule pattern="com.google.inject.internal.util.*" result="com.google.inject.internal.util.$@1"/> <rule pattern="com.google.inject.internal.util.**.*" result="com.google.inject.internal.util.@1.$@2"/>
       <keep pattern="com.google.inject.**"/>
=======================================
--- /trunk/core/test/com/google/inject/internal/util/LineNumbersTest.java Sun Feb 13 17:01:01 2011 +++ /trunk/core/test/com/google/inject/internal/util/LineNumbersTest.java Thu Feb 24 06:49:01 2011
@@ -25,10 +25,6 @@
 import com.google.inject.matcher.Matchers;
 import java.lang.reflect.Modifier;
 import junit.framework.TestCase;
-import org.objectweb.asm.ClassWriter;
-import org.objectweb.asm.MethodVisitor;
-import org.objectweb.asm.Opcodes;
-import org.objectweb.asm.Type;

 /**
  * @author [email protected] (Jesse Wilson)
@@ -50,6 +46,11 @@
"at " + LineNumbersTest.class.getName(), ".configure(LineNumbersTest.java:");
     }
   }
+
+  static class A {
+    @Inject A(B b) {}
+  }
+  public interface B {}

   /*if[AOP]*/
   public void testCanHandleLineNumbersForGuiceGeneratedClasses() {
@@ -74,12 +75,6 @@
"at " + LineNumbersTest.class.getName(), ".configure(LineNumbersTest.java:");
     }
   }
-  /*end[AOP]*/
-
-  static class A {
-    @Inject A(B b) {}
-  }
-  public interface B {}

   static class GeneratingClassLoader extends ClassLoader {
     static String name = "__generated";
@@ -89,18 +84,22 @@
     }

     Class<?> generate() {
-      ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
- cw.visit(Opcodes.V1_5, Modifier.PUBLIC, name, null, Type.getInternalName(Object.class), null);
-
-      String sig = "("+Type.getDescriptor(B.class)+")V";
-
- MethodVisitor mv = cw.visitMethod(Modifier.PUBLIC, "<init>", sig, null, null);
-
-      mv.visitAnnotation(Type.getDescriptor(Inject.class), true);
+      org.objectweb.asm.ClassWriter cw =
+ new org.objectweb.asm.ClassWriter(org.objectweb.asm.ClassWriter.COMPUTE_MAXS);
+      cw.visit(org.objectweb.asm.Opcodes.V1_5,
+          Modifier.PUBLIC, name, null,
+          org.objectweb.asm.Type.getInternalName(Object.class), null);
+
+      String sig = "("+org.objectweb.asm.Type.getDescriptor(B.class)+")V";
+
+ org.objectweb.asm.MethodVisitor mv = cw.visitMethod(Modifier.PUBLIC, "<init>", sig, null, null);
+
+ mv.visitAnnotation(org.objectweb.asm.Type.getDescriptor(Inject.class), true);
       mv.visitCode();
-      mv.visitVarInsn(Opcodes.ALOAD, 0);
- mv.visitMethodInsn( Opcodes.INVOKESPECIAL, Type.getInternalName(Object.class), "<init>", "()V" );
-      mv.visitInsn(Opcodes.RETURN);
+      mv.visitVarInsn(org.objectweb.asm.Opcodes.ALOAD, 0);
+      mv.visitMethodInsn(org.objectweb.asm.Opcodes.INVOKESPECIAL,
+ org.objectweb.asm.Type.getInternalName(Object.class), "<init>", "()V" );
+      mv.visitInsn(org.objectweb.asm.Opcodes.RETURN);
       mv.visitMaxs(0, 0);
       mv.visitEnd();
       cw.visitEnd();
@@ -138,4 +137,5 @@
     Object instance = injector.getInstance(generated);
     assertEquals(instance.getClass(), generated);
   }
-}
+  /*end[AOP]*/
+}

--
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