summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoraclement <aclement>2006-02-16 16:50:34 +0000
committeraclement <aclement>2006-02-16 16:50:34 +0000
commite87458179ab929aae2bc6966a6e092813bdd14a3 (patch)
tree5cfbcdad74346a29b3d65791c5dabc2563cbfe70 /tests
parentd4219e12eaa86ed810392364931a92324dc2a67f (diff)
downloadaspectj-e87458179ab929aae2bc6966a6e092813bdd14a3.tar.gz
aspectj-e87458179ab929aae2bc6966a6e092813bdd14a3.zip
test and fix for 122370 (Andy & Helen) - code generated for @Decp busted.
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs151/pr122370/moody/AnnotationMoodImplementor.java5
-rw-r--r--tests/bugs151/pr122370/moody/AnnotationMoodIndicator.java22
-rw-r--r--tests/bugs151/pr122370/moody/MainClass.java17
-rw-r--r--tests/bugs151/pr122370/moody/Mood.java5
-rw-r--r--tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java4
-rw-r--r--tests/src/org/aspectj/systemtest/ajc151/ajc151.xml11
6 files changed, 64 insertions, 0 deletions
diff --git a/tests/bugs151/pr122370/moody/AnnotationMoodImplementor.java b/tests/bugs151/pr122370/moody/AnnotationMoodImplementor.java
new file mode 100644
index 000000000..008119bb6
--- /dev/null
+++ b/tests/bugs151/pr122370/moody/AnnotationMoodImplementor.java
@@ -0,0 +1,5 @@
+package moody;
+
+public class AnnotationMoodImplementor {
+
+}
diff --git a/tests/bugs151/pr122370/moody/AnnotationMoodIndicator.java b/tests/bugs151/pr122370/moody/AnnotationMoodIndicator.java
new file mode 100644
index 000000000..be8cab5f6
--- /dev/null
+++ b/tests/bugs151/pr122370/moody/AnnotationMoodIndicator.java
@@ -0,0 +1,22 @@
+package moody;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.DeclareParents;
+
+@Aspect
+public class AnnotationMoodIndicator {
+ public interface Moody {
+ Mood getMood();
+ void setMood(Mood mood);
+ }
+
+ 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="moody.AnnotationMoodImplementor",defaultImpl=MoodyImpl.class)
+ private Moody implementedInterface;
+}
diff --git a/tests/bugs151/pr122370/moody/MainClass.java b/tests/bugs151/pr122370/moody/MainClass.java
new file mode 100644
index 000000000..82e4a9534
--- /dev/null
+++ b/tests/bugs151/pr122370/moody/MainClass.java
@@ -0,0 +1,17 @@
+package moody;
+
+public class MainClass {
+
+ public static void main(String[] args) {
+ AnnotationMoodImplementor ami0 = new AnnotationMoodImplementor();
+ AnnotationMoodImplementor ami1 = new AnnotationMoodImplementor();
+
+ System.out.println("ami0's mood is " + ((AnnotationMoodIndicator.Moody) ami0).getMood());
+ ((AnnotationMoodIndicator.Moody) ami1).setMood(Mood.JOLLY);
+ System.out.println("ami1's mood is now " + ((AnnotationMoodIndicator.Moody) ami1).getMood());
+ System.out.println("ami0's mood is still " + ((AnnotationMoodIndicator.Moody) ami0).getMood());
+ }
+
+
+
+}
diff --git a/tests/bugs151/pr122370/moody/Mood.java b/tests/bugs151/pr122370/moody/Mood.java
new file mode 100644
index 000000000..50d0e84f0
--- /dev/null
+++ b/tests/bugs151/pr122370/moody/Mood.java
@@ -0,0 +1,5 @@
+package moody;
+
+public enum Mood {
+ HAPPY, JOLLY
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java
index 24b006fd2..95a246013 100644
--- a/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java
@@ -164,6 +164,10 @@ public class Ajc151Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
runTest("@AJ without JoinPoint import");
}
+ public void testAtAspectDeclareParentsRetainsFieldState_pr122370() {
+ runTest("@AJ declare parents retains field state");
+ }
+
/*
* Load-time weaving bugs and enhancements
*/
diff --git a/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml b/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml
index 46e8bc97d..c470c67bf 100644
--- a/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml
+++ b/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml
@@ -182,6 +182,17 @@
</compile>
</ajc-test>
+ <ajc-test dir="bugs151/pr122370" title="@AJ declare parents retains field state">
+ <compile files="moody/AnnotationMoodImplementor.java, moody/AnnotationMoodIndicator.java, moody/Mood.java, moody/MainClass.java" options="-1.5"/>
+ <run class="moody.MainClass">
+ <stdout>
+ <line text="ami0's mood is HAPPY"/>
+ <line text="ami1's mood is now JOLLY"/>
+ <line text="ami0's mood is still HAPPY"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
<!-- New features down here... when they arent big enough to have their own test file -->
<ajc-test dir="features151/ptw" title="exposing withintype">