]> source.dussan.org Git - aspectj.git/commitdiff
fix and test for Bugzilla Bug 43194
authorjhugunin <jhugunin>
Thu, 18 Sep 2003 18:38:14 +0000 (18:38 +0000)
committerjhugunin <jhugunin>
Thu, 18 Sep 2003 18:38:14 +0000 (18:38 +0000)
   java.lang.VerifyError in generated code

Bug was that a portion of ReferencePointcut.concretize was not behaving
functionally but was mutating state.

tests/ajcTests.xml
tests/bugs/AdviceInteraction.java [new file with mode: 0644]
weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java

index 39dd3b14693bc0448d8e88a0900475872c730b7d..9fd028f8fcbdc4e1d55afb502cfb95479d2fdf27 100644 (file)
         <compile files="ParentsAndPointcuts.java"/>
         <run class="ParentsAndPointcuts"/>
     </ajc-test>
+    
+    <ajc-test dir="bugs" pr="43194"
+        title="Non-functional concretezation of ReferencePointcut">
+        <compile files="AdviceInteraction.java"/>
+        <run class="AdviceInteraction"/>
+    </ajc-test>
 </suite>
diff --git a/tests/bugs/AdviceInteraction.java b/tests/bugs/AdviceInteraction.java
new file mode 100644 (file)
index 0000000..1d72ad5
--- /dev/null
@@ -0,0 +1,25 @@
+public class AdviceInteraction {
+    public static void main(String [] args) {
+        new C().m1();
+    }
+}
+
+class C {    
+    public void m1() {}
+    public void m2() {}
+}
+
+aspect A {    
+    pointcut exec1(C c): this(c) && execution(void m1());
+    pointcut execs(C c): exec1(c); 
+    
+    before (): execs(*) {}
+    before (C c):  execs(c) {}
+
+    // This ordering works correctly
+    pointcut exec2(C c): this(c) && execution(void m2());
+    pointcut execs2(C c): exec2(c); 
+    
+    before (C c):  execs2(c) {}
+    before (): execs2(*) {}
+}
\ No newline at end of file
index 907836447eac8c8e076a4446d58ac98c6b2a599f..8781641c7fb929c33ba3754cbba10e33a2148c8c 100644 (file)
@@ -249,7 +249,7 @@ public class ReferencePointcut extends Pointcut {
                        //System.err.println("start: " + searchStart);
                        ResolvedTypeX[] parameterTypes = searchStart.getWorld().resolve(pointcutDec.getParameterTypes());
                        
-                       arguments = arguments.resolveReferences(bindings);
+                       TypePatternList arguments = this.arguments.resolveReferences(bindings);
                        
                        IntMap newBindings = new IntMap();
                        for (int i=0,len=arguments.size(); i < len; i++) {