aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs172/pr398246/Code5.java20
-rw-r--r--tests/bugs172/pr398246/Code5a.java25
-rw-r--r--tests/bugs172/pr398246/Code6.java22
-rw-r--r--tests/bugs172/pr398246/Code7.java20
-rw-r--r--tests/src/org/aspectj/systemtest/ajc172/Ajc172Tests.java71
-rw-r--r--tests/src/org/aspectj/systemtest/ajc172/ajc172.xml35
6 files changed, 174 insertions, 19 deletions
diff --git a/tests/bugs172/pr398246/Code5.java b/tests/bugs172/pr398246/Code5.java
new file mode 100644
index 000000000..50512d496
--- /dev/null
+++ b/tests/bugs172/pr398246/Code5.java
@@ -0,0 +1,20 @@
+import java.lang.annotation.*;
+
+public class Code5 {
+ public static boolean isTrue = true;
+
+ public void m() {
+ }
+ public static void main(String []argv) {
+ new Code5().m();
+ }
+}
+
+aspect X {
+
+ pointcut p(): execution(* Code*.*(..)) && if(Code5.isTrue);
+
+ before(): p() {
+ System.out.println("advice");
+ }
+}
diff --git a/tests/bugs172/pr398246/Code5a.java b/tests/bugs172/pr398246/Code5a.java
new file mode 100644
index 000000000..0f5562640
--- /dev/null
+++ b/tests/bugs172/pr398246/Code5a.java
@@ -0,0 +1,25 @@
+import java.lang.annotation.*;
+
+public class Code5a {
+ public static boolean isTrue = true;
+
+ public void m() {
+ }
+ public static void main(String []argv) {
+ new Code5a().m();
+ }
+}
+
+
+// more white space, on purpose
+
+
+
+aspect X2 {
+
+
+ pointcut p(): execution(* Code*.*(..)) && if(Code5.isTrue);
+ before(): p() {
+ System.out.println("advice");
+ }
+}
diff --git a/tests/bugs172/pr398246/Code6.java b/tests/bugs172/pr398246/Code6.java
new file mode 100644
index 000000000..e032eb7c9
--- /dev/null
+++ b/tests/bugs172/pr398246/Code6.java
@@ -0,0 +1,22 @@
+import java.lang.annotation.*;
+
+public class Code6 {
+ public static boolean isTrue = true;
+ public static boolean isTrue2 = true;
+
+ public void m() {
+ }
+
+ public static void main(String []argv) {
+ new Code6().m();
+ }
+}
+
+aspect X {
+
+ pointcut p(): execution(* Code*.*(..)) && if(Code6.isTrue) && if(Code6.isTrue2);
+
+ before(): p() {
+ System.out.println("advice");
+ }
+}
diff --git a/tests/bugs172/pr398246/Code7.java b/tests/bugs172/pr398246/Code7.java
new file mode 100644
index 000000000..e8d47a5a1
--- /dev/null
+++ b/tests/bugs172/pr398246/Code7.java
@@ -0,0 +1,20 @@
+import java.lang.annotation.*;
+
+public class Code7 {
+ public static boolean isTrue = true;
+ public static boolean isTrue2 = true;
+
+ public void m() {
+ }
+
+ public static void main(String []argv) {
+ new Code7().m();
+ }
+}
+
+aspect X {
+
+ before(): execution(* Code*.*(..)) && if(Code7.isTrue) && if(Code7.isTrue2) {
+ System.out.println("advice");
+ }
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc172/Ajc172Tests.java b/tests/src/org/aspectj/systemtest/ajc172/Ajc172Tests.java
index eea4030d0..fd9454164 100644
--- a/tests/src/org/aspectj/systemtest/ajc172/Ajc172Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc172/Ajc172Tests.java
@@ -23,36 +23,69 @@ import org.aspectj.testing.XMLBasedAjcTestCase;
*/
public class Ajc172Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
- public void testIfPointcutNames_pr398246() throws Exception{
+ public void testIfPointcutNames_pr398246() throws Exception {
runTest("if pointcut names");
- JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"X");
- Method m = getMethodStartsWith(jc,"ajc$if");
- assertEquals("ajc$if$andy",m.getName());
+ JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "X");
+ Method m = getMethodStartsWith(jc, "ajc$if");
+ assertEquals("ajc$if$andy", m.getName());
}
-
+
public void testIfPointcutNames_pr398246_2() throws Exception {
runTest("if pointcut names 2");
- JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"X");
- Method m = getMethodStartsWith(jc,"ajc$if");
- assertEquals("ajc$if$fred",m.getName());
+ JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "X");
+ Method m = getMethodStartsWith(jc, "ajc$if");
+ assertEquals("ajc$if$fred", m.getName());
}
-
+
// fully qualified annotation name is used
public void testIfPointcutNames_pr398246_3() throws Exception {
runTest("if pointcut names 3");
- JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"X");
- Method m = getMethodStartsWith(jc,"ajc$if");
- assertEquals("ajc$if$barney",m.getName());
+ JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "X");
+ Method m = getMethodStartsWith(jc, "ajc$if");
+ assertEquals("ajc$if$barney", m.getName());
}
-
- // compiling a class later than the initial build - does it pick up the right if clause name?
- public void testIfPointcutNames_pr398246_4() throws Exception{
+
+ // compiling a class later than the initial build - does it pick up the
+ // right if clause name?
+ public void testIfPointcutNames_pr398246_4() throws Exception {
runTest("if pointcut names 4");
- JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"X");
- Method m = getMethodStartsWith(jc,"ajc$if");
- assertEquals("ajc$if$sid",m.getName());
+ JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "X");
+ Method m = getMethodStartsWith(jc, "ajc$if");
+ assertEquals("ajc$if$sid", m.getName());
+ }
+
+ // new style generated names
+ public void testIfPointcutNames_pr398246_5() throws Exception {
+ runTest("if pointcut names 5");
+ JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "X");
+ Method m = getMethodStartsWith(jc, "ajc$if");
+ assertEquals("ajc$if$ac0cb804", m.getName());
+
+ jc = getClassFrom(ajc.getSandboxDirectory(), "X2");
+ m = getMethodStartsWith(jc, "ajc$if");
+ assertEquals("ajc$if$ac0cb804", m.getName());
}
-
+
+ // new style generated names - multiple ifs in one pointcut
+ public void testIfPointcutNames_pr398246_6() throws Exception {
+ runTest("if pointcut names 6");
+ JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "X");
+ Method m = getMethodStartsWith(jc, "ajc$if",1);
+ assertEquals("ajc$if$aac93da8", m.getName());
+ m = getMethodStartsWith(jc, "ajc$if",2);
+ assertEquals("ajc$if$1$ae5e778a", m.getName());
+ }
+
+ // new style generated names - multiple ifs in one advice
+ public void testIfPointcutNames_pr398246_7() throws Exception {
+ runTest("if pointcut names 7");
+ JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "X");
+ Method m = getMethodStartsWith(jc, "ajc$if",1);
+ assertEquals("ajc$if$1$ac0607c", m.getName());
+ m = getMethodStartsWith(jc, "ajc$if",2);
+ assertEquals("ajc$if$1$1$4d4baf36", m.getName());
+ }
+
public void testOptionalAspects_pr398588() {
runTest("optional aspects");
}
diff --git a/tests/src/org/aspectj/systemtest/ajc172/ajc172.xml b/tests/src/org/aspectj/systemtest/ajc172/ajc172.xml
index 7dc6ce11b..606ae311e 100644
--- a/tests/src/org/aspectj/systemtest/ajc172/ajc172.xml
+++ b/tests/src/org/aspectj/systemtest/ajc172/ajc172.xml
@@ -84,6 +84,41 @@
</stdout>
</run>
</ajc-test>
+
+ <ajc-test dir="bugs172/pr398246" title="if pointcut names 5">
+ <compile files="Code5.java Code5a.java" options="-1.5">
+ </compile>
+ <run class="Code5" options="-1.5">
+ <stdout>
+ <line text="advice"/>
+ <line text="advice"/>
+ <line text="advice"/>
+ <line text="advice"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs172/pr398246" title="if pointcut names 6">
+ <compile files="Code6.java" options="-1.5">
+ </compile>
+ <run class="Code6" options="-1.5">
+ <stdout>
+ <line text="advice"/>
+ <line text="advice"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs172/pr398246" title="if pointcut names 7">
+ <compile files="Code7.java" options="-1.5">
+ </compile>
+ <run class="Code7" options="-1.5">
+ <stdout>
+ <line text="advice"/>
+ <line text="advice"/>
+ </stdout>
+ </run>
+ </ajc-test>
<ajc-test dir="bugs172/pr389750" title="inconsistent class file">
<compile files="Code.aj" options="-1.5">