aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/IntroOnIntro.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/IntroOnIntro.java
parentfafae443719b26159ab2d7dac1c9b46b5e00b671 (diff)
downloadaspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz
aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip
initial version
Diffstat (limited to 'tests/new/IntroOnIntro.java')
-rw-r--r--tests/new/IntroOnIntro.java61
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/new/IntroOnIntro.java b/tests/new/IntroOnIntro.java
new file mode 100644
index 000000000..ca8d0a96b
--- /dev/null
+++ b/tests/new/IntroOnIntro.java
@@ -0,0 +1,61 @@
+import org.aspectj.testing.*;
+
+public class IntroOnIntro {
+ public static void main(String[] args) {
+ Class1 c1 = new Class1();
+
+ try {
+ c1.getName();
+ } catch (NoSuchMethodError nsme) {
+ Tester.check(false, "getName was not found in Class1");
+ }
+
+ try {
+ c1.m = "potato";
+ } catch (NoSuchFieldError nsfe) {
+ Tester.check(false, "m was not introduced into Class1");
+ }
+ }
+}
+
+class Class1 {
+ String name = ""; //public String getName() { return name; }
+}
+
+aspect Aspect1 /**of eachobject (instanceof(Class1))*/ {
+ public String Class1.getName() { return this.name; }
+
+ void f() {}
+ before(): call(* getName(..)) && this(Class1) {
+ f();
+ }
+}
+
+aspect AComposer /**of eachobject(instanceof(Class1 || Aspect1))*/ {
+ interface HasManager {}
+ private String HasManager.my_manager;
+ String HasManager.m;
+ public void HasManager.setManager(String manager) {
+ this.my_manager = manager;
+ }
+ declare parents: Class1 || Aspect1 implements HasManager;
+
+ before(Aspect1 a1): call(void f()) && this(a1) {
+
+ try {
+ a1.setManager("potato");
+ } catch (NoSuchMethodError nsme) {
+ Tester.check(false, "getName not found in Aspect1");
+ }
+
+ try {
+ a1.m = "potato";
+ } catch (NoSuchFieldError nsfe) {
+ Tester.check(false, "m was not introduced into Class1");
+ }
+ }
+}
+
+
+
+