summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoracolyer <acolyer>2004-12-15 20:51:01 +0000
committeracolyer <acolyer>2004-12-15 20:51:01 +0000
commit1b6e9edfacf5f3d2732d164b15bc26022835c6ac (patch)
tree120b839c6f1760e266f56acf6aea89723d7b1f07 /tests
parent1575a175b511eadbae03fc760b0cd20edde6ae4e (diff)
downloadaspectj-1b6e9edfacf5f3d2732d164b15bc26022835c6ac.tar.gz
aspectj-1b6e9edfacf5f3d2732d164b15bc26022835c6ac.zip
partial fix for bug 61568.
These changes are both (a) a performance optimization, and (b) an improvement on the binding across || rules that we implemented in 1.2.1. Instead of saying the the first binding in a left-to-right traversal of the pointcuts DNF is the one that you get (too much to ask users to do DNF rewriting in their heads), this version implements the rule that every || branch in the DNF must bind all formals, and if two || branches can have any join points in common (can match join points of the same kind), then both must bind all formals identically. So it allows things like execution(* *(..)) && args(x) || call(* *(..)) && this(x) which previously we used to forbid. But primarily it turned out to be a performance optimization.
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/DisjunctVarBinding.java2
-rw-r--r--tests/bugs/DisjunctVarBinding_3.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc120/ajc120-tests.xml3
-rw-r--r--tests/src/org/aspectj/systemtest/ajc121/ajc121-tests.xml19
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/VarargsTests.java4
5 files changed, 13 insertions, 17 deletions
diff --git a/tests/bugs/DisjunctVarBinding.java b/tests/bugs/DisjunctVarBinding.java
index 6d59f354f..7c40cd070 100644
--- a/tests/bugs/DisjunctVarBinding.java
+++ b/tests/bugs/DisjunctVarBinding.java
@@ -14,7 +14,7 @@ class B extends A {
aspect IfPointcut {
after(A a, B b) returning:
- call(* foo(*,*)) &&
+ execution(* foo(*,*)) &&
(args(b,a) || args(a,b)) {
System.out.println("Woven");
}
diff --git a/tests/bugs/DisjunctVarBinding_3.java b/tests/bugs/DisjunctVarBinding_3.java
index 3876b3521..95713d361 100644
--- a/tests/bugs/DisjunctVarBinding_3.java
+++ b/tests/bugs/DisjunctVarBinding_3.java
@@ -1,7 +1,7 @@
aspect IfPointcut {
after(A a, B b) returning:
- call(* foo(*,*)) &&
+ execution(* foo(*,*)) &&
(args(b,a) || args(a,b)) {
System.out.println("Woven");
}
diff --git a/tests/src/org/aspectj/systemtest/ajc120/ajc120-tests.xml b/tests/src/org/aspectj/systemtest/ajc120/ajc120-tests.xml
index 4ab8eb355..8381d4e01 100644
--- a/tests/src/org/aspectj/systemtest/ajc120/ajc120-tests.xml
+++ b/tests/src/org/aspectj/systemtest/ajc120/ajc120-tests.xml
@@ -454,8 +454,7 @@
<ajc-test dir="bugs"
pr="61568" title="wrong variable binding in || pointcuts">
<compile files="DisjunctVarBinding.java">
- <message kind="error" line="34" text="Ambiguous binding of type B"/>
- <message kind="error" line="34" text="Ambiguous binding of type A"/>
+ <message kind="error" line="17" text="ambiguous binding of parameter(s) a, b across '||' in pointcut"/>
</compile>
</ajc-test>
diff --git a/tests/src/org/aspectj/systemtest/ajc121/ajc121-tests.xml b/tests/src/org/aspectj/systemtest/ajc121/ajc121-tests.xml
index 77d52f3dc..9089289e9 100644
--- a/tests/src/org/aspectj/systemtest/ajc121/ajc121-tests.xml
+++ b/tests/src/org/aspectj/systemtest/ajc121/ajc121-tests.xml
@@ -4,12 +4,10 @@
<ajc-test dir="bugs"
pr="62073" title="false ambiguous binding error (introduced in 1.2rc2)">
<compile files="DisjunctVarBinding_2.java,DisjunctVarBinding_3.java">
- <message kind="error" line="25" file="DisjunctVarBinding_2.java" text="Ambiguous binding of type B"/>
- <message kind="error" line="25" file="DisjunctVarBinding_2.java" text="Ambiguous binding of type A"/>
+ <message kind="error" line="4" file="DisjunctVarBinding_3.java" text="ambiguous binding of parameter(s) a, b across '||' in pointcut"/>
</compile>
<compile files="DisjunctVarBinding_3.java,DisjunctVarBinding_2.java">
- <message kind="error" line="25" file="DisjunctVarBinding_2.java" text="Ambiguous binding of type B"/>
- <message kind="error" line="25" file="DisjunctVarBinding_2.java" text="Ambiguous binding of type A"/>
+ <message kind="error" line="4" file="DisjunctVarBinding_3.java" text="ambiguous binding of parameter(s) a, b across '||' in pointcut"/>
</compile>
</ajc-test>
@@ -213,14 +211,11 @@
<ajc-test dir="bugs/oxford" pr="65319"
title="ajc crashes when compiling the following program (binding this() and target())">
<compile files="PR65319.java">
- <message kind="error" line="7" text="Cannot use target() to match at this"/>
- <message kind="error" line="7" text="Cannot use this() to match at this"/>
- <message kind="error" line="11" text="Cannot use target() to match at this"/>
- <message kind="error" line="11" text="Cannot use this() to match at this"/>
- <message kind="error" line="11" text="Ambiguous binding of type Test"/>
- <message kind="error" line="15" text="Cannot use target() to match at this"/>
- <message kind="error" line="15" text="Cannot use this() to match at this"/>
- <message kind="error" line="15" text="Ambiguous binding of type Test"/>
+ <!-- target comes before this comes before args, and we only report one error -->
+ <message kind="error" line="23" text="ambiguous binding of parameter(s) x across '||' in pointcut"/>
+ <message kind="error" line="25" text="ambiguous binding of parameter(s) x across '||' in pointcut"/>
+ <message kind="error" line="27" text="ambiguous binding of parameter(s) x across '||' in pointcut"/>
+ <message kind="error" line="29" text="ambiguous binding of parameter(s) x across '||' in pointcut"/>
</compile>
</ajc-test>
diff --git a/tests/src/org/aspectj/systemtest/ajc150/VarargsTests.java b/tests/src/org/aspectj/systemtest/ajc150/VarargsTests.java
index 7845f6bd1..178e82b18 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/VarargsTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/VarargsTests.java
@@ -59,10 +59,12 @@ public class VarargsTests extends TestUtils {
// In this test, it can be tricky to understand the results!! The reason being that the shadow
// isn't included in the error message (it really should be, but thats a bit hard to do cleanly)
public void test003_cantMatchVarargsWithObjectArray_withincodePCD() {
- CompilationResult cR = binaryWeave("testcode.jar","VarargsAspect04.aj",0,7,true);
+ CompilationResult cR = binaryWeave("testcode.jar","VarargsAspect04.aj",0,6,true);
// There are 7. Each piece of the pointcut is matched against all the shadows, so both
// the 'withincode' PCD and the 'call' PCD are matched against every join point.
+ // AMC - there are now SIX. We detect early that a call(* *(..)) pcd cannot match
+ // constructor call shadows and never do the match.
assertTrue("Did not get expected message about a varargs mismatch, instead got: "+cR.getWarningMessages(),
((IMessage)cR.getWarningMessages().get(0)).toString().indexOf("varargs declared method")!=-1);