aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/MultiDispatchCf.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/MultiDispatchCf.java
parentfafae443719b26159ab2d7dac1c9b46b5e00b671 (diff)
downloadaspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz
aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip
initial version
Diffstat (limited to 'tests/new/MultiDispatchCf.java')
-rw-r--r--tests/new/MultiDispatchCf.java74
1 files changed, 74 insertions, 0 deletions
diff --git a/tests/new/MultiDispatchCf.java b/tests/new/MultiDispatchCf.java
new file mode 100644
index 000000000..d158240de
--- /dev/null
+++ b/tests/new/MultiDispatchCf.java
@@ -0,0 +1,74 @@
+import org.aspectj.testing.Tester;
+
+public class MultiDispatchCf {
+ public static void main(String[] args) {
+ C c = new C();
+
+ Tester.event("**** exec ****");
+ //MultiExec.enabled = true;
+ run(new C());
+
+ Tester.event("**** call ****");
+ //MultiExec.enabled = false;
+ //MultiCall.enabled = true;
+ run(new C());
+
+ Tester.event("**** both=call ****");
+ //MultiExec.enabled = true;
+ run(new C());
+
+ Tester.printEvents();
+ }
+
+ static void run(C c) {
+ Tester.event(c.doit("s1"));
+ Tester.event(c.doit(new Integer(10)));
+ Tester.event(c.doit(new Double(1.25)));
+
+ Object o;
+ o = "s2"; Tester.event(c.doit(o));
+ o = new Integer(20); Tester.event(c.doit(o));
+ o = new Double(2.25); Tester.event(c.doit(o));
+ }
+}
+
+
+class C {
+ String doit(Object o) {
+ return "did-" + o.toString();
+ }
+}
+
+aspect MultiCall {
+ pointcut t1(String s): call(String C.doit(Object)) && args(s);
+
+ String around(String s): t1(s) { return proceed(s); }
+ String around(Object o): t1(o) { return proceed(o); }
+
+
+
+ pointcut m(Object o): call(String C.doit(Object)) && args(o);
+
+ String getPrefix() { return "call"; }
+
+ String around(String s): m(s) { //ERR
+ return getPrefix() + "-string-" + s;
+ }
+ String around(Integer i): m(i) { //ERR
+ return getPrefix() + "-integer-" + i;
+ }
+ String around(Double d): m(d) { //ERR
+ return getPrefix() + "-double-" + d;
+ }
+}
+
+aspect MultiCreate {
+ pointcut make(Object o): this(o) && execution(new(..));
+
+ private interface I {}
+ declare parents: C implements I;
+
+ before(I i): make(i) { //ERR: doesn't match Object
+ System.out.println("new I: " + i);
+ }
+}