aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/PR353b.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/PR353b.java
parentfafae443719b26159ab2d7dac1c9b46b5e00b671 (diff)
downloadaspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz
aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip
initial version
Diffstat (limited to 'tests/new/PR353b.java')
-rw-r--r--tests/new/PR353b.java51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/new/PR353b.java b/tests/new/PR353b.java
new file mode 100644
index 000000000..4419d9203
--- /dev/null
+++ b/tests/new/PR353b.java
@@ -0,0 +1,51 @@
+import org.aspectj.lang.*;
+import org.aspectj.lang.reflect.*;
+import org.aspectj.testing.*;
+import java.util.*;
+
+public class PR353b {
+
+ public static void main(String[] args){
+ new PR353b().go();
+ }
+
+ void go(){
+ s.c = "E"; C c = new E(); c.foo();
+ s.c = "C"; c = new C(); c.foo();
+ s.c = "E"; E e = new E(); e.foo();
+ s.c = "E2"; E2 e2 = new E2(); e2.foo();
+ s.c = "F"; F f = new F(); f.foo();
+ }
+
+ static {
+ Tester.expectEvent("call C");
+ Tester.expectEvent("call E2");
+ }
+}
+
+class C { void foo() {} }
+class E extends C {}
+class F extends E {}
+class E2 extends C { void foo() {} }
+
+class s { public static String c; }
+
+aspect A {
+
+ pointcut p3(): this(C) && call(* foo()) && !target(E);
+ before(): p3() {
+ Object target = thisJoinPoint.getTarget();
+ JoinPoint.StaticPart sp = thisJoinPoint.getStaticPart();
+ Signature sig = sp.getSignature();
+ Class dt = sig.getDeclaringType();
+ Tester.check(!(target instanceof E),
+ target.getClass().getName() + " instanceof E");
+ Tester.event("call " + target.getClass().getName());
+ Tester.check(dt == PR353b.class,
+ "dt != instanceof PR353b");
+ Tester.check(!(target instanceof E),
+ "!instanceof E");
+ String c = thisJoinPoint.getSignature().getDeclaringType().getName();
+ Tester.check(s.c.equals(c), "p3: " + s.c + " != " + c);
+ }
+}