]> source.dussan.org Git - aspectj.git/commitdiff
test and fix for 128237 from Helen
authoraclement <aclement>
Tue, 21 Feb 2006 15:55:33 +0000 (15:55 +0000)
committeraclement <aclement>
Tue, 21 Feb 2006 15:55:33 +0000 (15:55 +0000)
tests/bugs151/pr128237.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java
tests/src/org/aspectj/systemtest/ajc151/ajc151.xml
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java

diff --git a/tests/bugs151/pr128237.java b/tests/bugs151/pr128237.java
new file mode 100644 (file)
index 0000000..93af416
--- /dev/null
@@ -0,0 +1,29 @@
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.annotation.Pointcut;
+
+@Aspect
+class AbstractTracer 
+{
+       
+    @Pointcut("(execution(public * Foo.anotherMethod*(..)) || execution(public * Foo.methodA(..))) && this(obj)")
+    protected void methodExec(Object obj){};
+        
+    @Before("methodExec(obj)")
+    public void beforeMethodExec(JoinPoint thisJoinPoint, Object obj) {
+       System.out.println("Before " + thisJoinPoint.getSignature().toString());
+    }
+       
+}
+
+
+class Foo {
+
+       public void methodA() {
+       }
+       
+       public void anotherMethod() {
+       }
+       
+}
index 0832c4a47e564048a1d8d3f53fc926228c0a7404..2672caa3e60daea1bb8ca4bddde66f21a4dac5c1 100644 (file)
@@ -170,6 +170,10 @@ public class Ajc151Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
          runTest("@AJ declare parents retains field state");
   }
   
+  public void testAtAspectNoNPEWithPcdContainingOrThisAndWildcard_pr128237() {
+         runTest("@AJ no npe with pointcut containing or, this and a wildcard");
+  }
+  
   /*
    * Load-time weaving bugs and enhancements
    */
index c76ccbac7fe47cffa676f3c1b6441dbdc94e8c21..d340d0778949a3c946ac1f383aec56a0b5915805 100644 (file)
         </run>
     </ajc-test>
 
+    <ajc-test dir="bugs151" title="@AJ no npe with pointcut containing or, this and a wildcard">
+        <compile files="pr128237.java" options="-1.5"/>
+    </ajc-test>
+
     <!-- New features down here... when they arent big enough to have their own test file -->
     
     <ajc-test dir="features151/ptw" title="exposing withintype">
index 118e7bfee1dc75966b8d5271b665c35af1ebf739..31dbacd0a16fe8e6369160c267690501e7a78c7f 100644 (file)
@@ -611,7 +611,11 @@ public class BcelWeaver implements IWeaver {
                        // if each branch binds it in exactly the same way...
                        List ambiguousNames = new ArrayList();
                        for (int i = 0; i < numFormals; i++) {
-                               if (!leftBindings[i].equals(rightBindings[i])) {
+                               if (leftBindings[i] == null) {
+                                       if (rightBindings[i] != null) {
+                                               ambiguousNames.add(names[i]);
+                                       }
+                               } else if (!leftBindings[i].equals(rightBindings[i])) {
                                        ambiguousNames.add(names[i]);
                                }
                        }