]> source.dussan.org Git - aspectj.git/commitdiff
testcode for 121384: NPE on incremental compilation @decp
authoraclement <aclement>
Mon, 19 Dec 2005 14:51:53 +0000 (14:51 +0000)
committeraclement <aclement>
Mon, 19 Dec 2005 14:51:53 +0000 (14:51 +0000)
tests/multiIncremental/pr121384/base/moodytest/AnnotationMoodIndicator.java [new file with mode: 0644]
tests/multiIncremental/pr121384/base/moodytest/AnnotationMoodyImplementor.java [new file with mode: 0644]
tests/multiIncremental/pr121384/base/moodytest/Mood.java [new file with mode: 0644]
tests/multiIncremental/pr121384/inc1/moodytest/AnnotationMoodTester.java [new file with mode: 0644]

diff --git a/tests/multiIncremental/pr121384/base/moodytest/AnnotationMoodIndicator.java b/tests/multiIncremental/pr121384/base/moodytest/AnnotationMoodIndicator.java
new file mode 100644 (file)
index 0000000..6872077
--- /dev/null
@@ -0,0 +1,22 @@
+package moodytest;
+
+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 {
+     Mood mood = Mood.HAPPY;
+
+     public Mood getMood() { return mood; }
+     public void setMood(Mood mood) { this.mood = mood; }
+  }
+
+  @DeclareParents(value="moodytest.AnnotationMoodyImplementor",defaultImpl=MoodyImpl.class)
+  private Moody introduced;
+}
diff --git a/tests/multiIncremental/pr121384/base/moodytest/AnnotationMoodyImplementor.java b/tests/multiIncremental/pr121384/base/moodytest/AnnotationMoodyImplementor.java
new file mode 100644 (file)
index 0000000..7cab32f
--- /dev/null
@@ -0,0 +1,5 @@
+package moodytest;
+
+public class AnnotationMoodyImplementor {
+
+}
diff --git a/tests/multiIncremental/pr121384/base/moodytest/Mood.java b/tests/multiIncremental/pr121384/base/moodytest/Mood.java
new file mode 100644 (file)
index 0000000..6fca1be
--- /dev/null
@@ -0,0 +1,5 @@
+package moodytest;
+
+public enum Mood {
+       HAPPY, SAD, CONFUSED
+}
diff --git a/tests/multiIncremental/pr121384/inc1/moodytest/AnnotationMoodTester.java b/tests/multiIncremental/pr121384/inc1/moodytest/AnnotationMoodTester.java
new file mode 100644 (file)
index 0000000..332bf85
--- /dev/null
@@ -0,0 +1,29 @@
+package moodytest;
+
+import moodytest.AnnotationMoodyImplementor;
+import moodytest.Mood;
+import junit.framework.TestCase;
+
+public class AnnotationMoodTester extends TestCase {
+          AnnotationMoodyImplementor ami0 = null;
+          AnnotationMoodyImplementor ami1 = null;
+
+          public AnnotationMoodTester(String name) { super(name); }
+
+          protected void setUp() throws Exception {
+             ami0 = new AnnotationMoodyImplementor();
+             ami1 = new AnnotationMoodyImplementor();
+          }
+
+          public void testHappyDefault() {
+             assertEquals("ami0 should be happy!", Mood.HAPPY, ami0.getMood());
+          }
+
+          public void testOneConfused() {
+             ami0.setMood(Mood.CONFUSED);
+             assertEquals("ami0 should now be confused", Mood.CONFUSED,
+        ami0.getMood());
+             assertEquals("ami1 should still be happy", Mood.HAPPY,
+        ami1.getMood());
+          }
+}