aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs151
diff options
context:
space:
mode:
authoraclement <aclement>2006-03-29 12:06:04 +0000
committeraclement <aclement>2006-03-29 12:06:04 +0000
commita2252d8b395f4da1e56bf77ea5d36e0c8d634ebd (patch)
tree2fe4505e5618d7f8217023e098ebc2924f7524ea /tests/bugs151
parente05ab26570eeb1776836d67e980c37e0813e30e3 (diff)
downloadaspectj-a2252d8b395f4da1e56bf77ea5d36e0c8d634ebd.tar.gz
aspectj-a2252d8b395f4da1e56bf77ea5d36e0c8d634ebd.zip
more tests for @DeclareParents - building it in pieces.
Diffstat (limited to 'tests/bugs151')
-rw-r--r--tests/bugs151/atDecp/case3/MainClass.java37
-rw-r--r--tests/bugs151/atDecp/case3/Mood.java3
-rw-r--r--tests/bugs151/atDecp/case3/Moody.java6
-rw-r--r--tests/bugs151/atDecp/case4/AnnotationMoodImplementor.java3
-rw-r--r--tests/bugs151/atDecp/case4/MainClass.java19
-rw-r--r--tests/bugs151/atDecp/case4/Mood.java3
-rw-r--r--tests/bugs151/atDecp/case4/Moody.java6
-rw-r--r--tests/bugs151/atDecp/case4/MoodyImpl.java10
-rw-r--r--tests/bugs151/atDecp/case4/TheAspect.java13
9 files changed, 100 insertions, 0 deletions
diff --git a/tests/bugs151/atDecp/case3/MainClass.java b/tests/bugs151/atDecp/case3/MainClass.java
new file mode 100644
index 000000000..f4212e97c
--- /dev/null
+++ b/tests/bugs151/atDecp/case3/MainClass.java
@@ -0,0 +1,37 @@
+package theapp;
+
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.DeclareParents;
+
+import moody.*;
+
+class AnnotationMoodImplementor { }
+
+@Aspect
+class AnnotationMoodIndicator {
+
+ public static class MoodyImpl implements Moody {
+ private Mood mood = Mood.HAPPY;
+
+ public Mood getMood() { return mood; }
+ public void setMood(Mood mood) { this.mood = mood; }
+ }
+
+ @DeclareParents(value="theapp.AnnotationMoodImplementor",defaultImpl=MoodyImpl.class)
+ private Moody implementedInterface;
+}
+
+
+
+public class MainClass {
+ public static void main(String[] args) {
+ AnnotationMoodImplementor ami0 = new AnnotationMoodImplementor();
+ AnnotationMoodImplementor ami1 = new AnnotationMoodImplementor();
+
+ System.err.println("ami0's mood is " + ((Moody) ami0).getMood());
+ ((Moody) ami1).setMood(Mood.JOLLY);
+ System.err.println("ami1's mood is now " + ((Moody) ami1).getMood());
+ System.err.println("ami0's mood is still " + ((Moody) ami0).getMood());
+ }
+}
+
diff --git a/tests/bugs151/atDecp/case3/Mood.java b/tests/bugs151/atDecp/case3/Mood.java
new file mode 100644
index 000000000..9d0591b6f
--- /dev/null
+++ b/tests/bugs151/atDecp/case3/Mood.java
@@ -0,0 +1,3 @@
+package moody;
+
+public enum Mood { HAPPY, SAD, JOLLY, GRUMPY }
diff --git a/tests/bugs151/atDecp/case3/Moody.java b/tests/bugs151/atDecp/case3/Moody.java
new file mode 100644
index 000000000..13353c72e
--- /dev/null
+++ b/tests/bugs151/atDecp/case3/Moody.java
@@ -0,0 +1,6 @@
+package moody;
+
+public interface Moody {
+ Mood getMood();
+ void setMood(Mood mood);
+}
diff --git a/tests/bugs151/atDecp/case4/AnnotationMoodImplementor.java b/tests/bugs151/atDecp/case4/AnnotationMoodImplementor.java
new file mode 100644
index 000000000..548b1fac2
--- /dev/null
+++ b/tests/bugs151/atDecp/case4/AnnotationMoodImplementor.java
@@ -0,0 +1,3 @@
+package theapp;
+
+public class AnnotationMoodImplementor {}
diff --git a/tests/bugs151/atDecp/case4/MainClass.java b/tests/bugs151/atDecp/case4/MainClass.java
new file mode 100644
index 000000000..40a54564d
--- /dev/null
+++ b/tests/bugs151/atDecp/case4/MainClass.java
@@ -0,0 +1,19 @@
+package theapp;
+
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.DeclareParents;
+
+import moody.*;
+
+public class MainClass {
+ public static void main(String[] args) {
+ AnnotationMoodImplementor ami0 = new AnnotationMoodImplementor();
+ AnnotationMoodImplementor ami1 = new AnnotationMoodImplementor();
+
+ System.err.println("ami0's mood is " + ((Moody) ami0).getMood());
+ ((Moody) ami1).setMood(Mood.JOLLY);
+ System.err.println("ami1's mood is now " + ((Moody) ami1).getMood());
+ System.err.println("ami0's mood is still " + ((Moody) ami0).getMood());
+ }
+}
+
diff --git a/tests/bugs151/atDecp/case4/Mood.java b/tests/bugs151/atDecp/case4/Mood.java
new file mode 100644
index 000000000..9d0591b6f
--- /dev/null
+++ b/tests/bugs151/atDecp/case4/Mood.java
@@ -0,0 +1,3 @@
+package moody;
+
+public enum Mood { HAPPY, SAD, JOLLY, GRUMPY }
diff --git a/tests/bugs151/atDecp/case4/Moody.java b/tests/bugs151/atDecp/case4/Moody.java
new file mode 100644
index 000000000..13353c72e
--- /dev/null
+++ b/tests/bugs151/atDecp/case4/Moody.java
@@ -0,0 +1,6 @@
+package moody;
+
+public interface Moody {
+ Mood getMood();
+ void setMood(Mood mood);
+}
diff --git a/tests/bugs151/atDecp/case4/MoodyImpl.java b/tests/bugs151/atDecp/case4/MoodyImpl.java
new file mode 100644
index 000000000..01d926d98
--- /dev/null
+++ b/tests/bugs151/atDecp/case4/MoodyImpl.java
@@ -0,0 +1,10 @@
+package theapp;
+
+import moody.*;
+
+public class MoodyImpl implements Moody {
+ private Mood mood = Mood.HAPPY;
+
+ public Mood getMood() { return mood; }
+ public void setMood(Mood mood) { this.mood = mood; }
+}
diff --git a/tests/bugs151/atDecp/case4/TheAspect.java b/tests/bugs151/atDecp/case4/TheAspect.java
new file mode 100644
index 000000000..daeb0e14d
--- /dev/null
+++ b/tests/bugs151/atDecp/case4/TheAspect.java
@@ -0,0 +1,13 @@
+package theapp;
+
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.DeclareParents;
+
+import moody.Moody;
+
+@Aspect
+class AnnotationMoodIndicator {
+ @DeclareParents(value="theapp.AnnotationMoodImplementor",defaultImpl=MoodyImpl.class)
+ private Moody implementedInterface;
+}
+