aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/HasAspect.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/new/HasAspect.java')
-rw-r--r--tests/new/HasAspect.java48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/new/HasAspect.java b/tests/new/HasAspect.java
new file mode 100644
index 000000000..f335e6d05
--- /dev/null
+++ b/tests/new/HasAspect.java
@@ -0,0 +1,48 @@
+import org.aspectj.testing.*;
+
+public class HasAspect {
+ static boolean p = false;
+ public static void main(String[] args) {
+ HasAspect c = new HasAspect();
+ c.someMethod();
+ Tester.check(p, "p advice was not run");
+
+ Tester.check(A.aspectOf(c).advised, "hasaspect(A)");
+ Tester.check(B.aspectOf().advised, "hasaspect(B)");
+ Tester.check(C.aspectOf().advised, "hasaspect(C)");
+ }
+
+ public void someMethod() {}
+}
+
+aspect A pertarget(target(HasAspect)) {
+ boolean advised = false;
+
+ pointcut p(): call(void someMethod()) && hasaspect(A);
+ //pointcut p(): receptions(void someMethod()) && instanceof(HasAspect);
+
+ before() : p() {
+ HasAspect.p = true;
+ }
+}
+
+aspect B issingleton() {
+ boolean advised = false;
+}
+
+aspect C percflow(entries()) {
+ pointcut entries(): executions(void HasAspect.main(String[]));
+
+ boolean advised = false;
+}
+
+
+aspect TestAspect {
+ before(A a, B b, C c) : call(void someMethod())
+ && hasaspect(a) && hasaspect(b) && hasaspect(c)
+ {
+ a.advised = true;
+ b.advised = true;
+ c.advised = true;
+ }
+}