aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/HasAspect.java
diff options
context:
space:
mode:
authorwisberg <wisberg>2002-12-16 18:51:06 +0000
committerwisberg <wisberg>2002-12-16 18:51:06 +0000
commit144143c2970a1e874d74cdbd0f8c622d4282a3c3 (patch)
treeb12383d3d9e76c7e1f25f7fbec83051ef17f81fb /tests/new/HasAspect.java
parentfafae443719b26159ab2d7dac1c9b46b5e00b671 (diff)
downloadaspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz
aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip
initial version
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;
+ }
+}