aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/CallsTo.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/CallsTo.java
parentfafae443719b26159ab2d7dac1c9b46b5e00b671 (diff)
downloadaspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz
aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip
initial version
Diffstat (limited to 'tests/new/CallsTo.java')
-rw-r--r--tests/new/CallsTo.java96
1 files changed, 96 insertions, 0 deletions
diff --git a/tests/new/CallsTo.java b/tests/new/CallsTo.java
new file mode 100644
index 000000000..a4bedb983
--- /dev/null
+++ b/tests/new/CallsTo.java
@@ -0,0 +1,96 @@
+import org.aspectj.testing.Tester;
+
+public class CallsTo {
+ public static void main(String[] args) {
+ Tester.clearNotes();
+ //System.out.println("cleared events");
+ //Tester.printEvents();
+ C c = new C();
+ Tester.checkAndClear
+ ("ca-newC",
+ "new C");
+ c.m("a");
+ Tester.checkAndClear
+ ("re-all re-C ca-all ca-C ",
+ "c.m");
+ c.m_C("b");
+ Tester.checkAndClear
+ ("re-all re-C ca-all ca-C ",
+ "c.m_C");
+
+ c = new SubC();
+ Tester.checkAndClear
+ ("ca-newC",
+ "new SubC");
+ c.m("c");
+ Tester.checkAndClear
+ ("re-all re-C re-SubC ca-all ca-C ca-SubC ca-inst(SubC)",
+ "subc.m");
+ c.m_C("d");
+ Tester.checkAndClear
+ ("re-all re-C re-SubC ca-all ca-C ca-SubC ca-inst(SubC)",
+ "subc.m_C");
+
+ SubC subC = new SubC();
+ Tester.checkAndClear
+ ("ca-newC",
+ "new SubC");
+ subC.m("e");
+ Tester.checkAndClear
+ ("re-all re-C re-SubC ca-all ca-C ca-SubC ca-inst(SubC)",
+ "subc.m");
+ subC.m_C("f");
+ Tester.checkAndClear
+ ("re-all re-C re-SubC ca-all ca-C ca-SubC ca-inst(SubC)",
+ "subc.m_C");
+ subC.m_SubC();
+ Tester.checkAndClear
+ ("re-all re-SubC ca-all ca-SubC",
+ "subc.m_SubC");
+ }
+}
+
+class C {
+ public void m(String s1) {}
+ public void m_C(String s2) {}
+}
+
+class SubC extends C {
+ public void m(String s3) {}
+ public void m_SubC() {}
+}
+
+aspect A {
+// pointcut allReceptions(): receptions(void *(..)) && instanceof(C);
+// pointcut receptionsInC(String s): receptions(void C.*(s));
+// pointcut receptionsInSubC(): receptions(void SubC.*(..));
+
+ pointcut allcall(): call(void *(..)) && target(C+);
+ pointcut callInC(String s): call(void C+.*(String)) && args(s);
+ pointcut callInSubC(): call(void *(..)) && target(SubC);
+
+ before(): allcall() { note("re-all"); }
+ before(String s): callInC(s) { note("re-C"); }
+ before(): callInSubC() { note("re-SubC"); }
+
+ before(): allcall() { note("ca-all"); }
+ before(String s): callInC(s) { note("ca-C"); }
+ before(): callInSubC() { note("ca-SubC"); }
+
+
+ before(): call(void C.*(..)) && target(SubC) { note("ca-inst(SubC)"); }
+
+ // not implemented
+// before(OnSubC o): call(void C.*(..)) && (hasaspect(OnSubC) && target(o)) {
+// note("ca-asp(SubC)");
+// }
+
+ before(): call(C+.new(..)) { note("ca-newC"); }
+
+ private final static void note(String msg) {
+ Tester.note(msg);
+ }
+}
+
+aspect OnSubC /**of eachobject(instanceof(SubC))*/ {
+}
an class="na">label="%updateSiteName" url="http://download.eclipse.org/egit/updates"/> </url> <plugin id="org.eclipse.jgit" download-size="0" install-size="0" version="0.0.0" unpack="false"/> <plugin id="org.eclipse.jgit.archive" download-size="0" install-size="0" version="0.0.0" unpack="false"/> <plugin id="com.jcraft.jsch" download-size="0" install-size="0" version="0.0.0" unpack="false"/> <plugin id="javaewah" download-size="0" install-size="0" version="0.0.0" unpack="false"/> <plugin id="org.apache.commons.compress" download-size="0" install-size="0" version="0.0.0" unpack="false"/> <plugin id="org.slf4j.api" download-size="0" install-size="0" version="0.0.0" unpack="false"/> <plugin id="org.slf4j.impl.log4j12" download-size="0" install-size="0" version="0.0.0" fragment="true" unpack="false"/> <plugin id="org.apache.log4j" download-size="0" install-size="0" version="0.0.0" unpack="false"/> <plugin id="com.jcraft.jzlib" download-size="0" install-size="0" version="0.0.0" unpack="false"/> </feature>