From 4a306cf6210cc47433b00822bf168f18a45f7951 Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 19 Dec 2005 14:51:53 +0000 Subject: [PATCH] testcode for 121384: NPE on incremental compilation @decp --- .../moodytest/AnnotationMoodIndicator.java | 22 ++++++++++++++ .../moodytest/AnnotationMoodyImplementor.java | 5 ++++ .../pr121384/base/moodytest/Mood.java | 5 ++++ .../inc1/moodytest/AnnotationMoodTester.java | 29 +++++++++++++++++++ 4 files changed, 61 insertions(+) create mode 100644 tests/multiIncremental/pr121384/base/moodytest/AnnotationMoodIndicator.java create mode 100644 tests/multiIncremental/pr121384/base/moodytest/AnnotationMoodyImplementor.java create mode 100644 tests/multiIncremental/pr121384/base/moodytest/Mood.java create mode 100644 tests/multiIncremental/pr121384/inc1/moodytest/AnnotationMoodTester.java diff --git a/tests/multiIncremental/pr121384/base/moodytest/AnnotationMoodIndicator.java b/tests/multiIncremental/pr121384/base/moodytest/AnnotationMoodIndicator.java new file mode 100644 index 000000000..6872077e9 --- /dev/null +++ b/tests/multiIncremental/pr121384/base/moodytest/AnnotationMoodIndicator.java @@ -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 index 000000000..7cab32f5c --- /dev/null +++ b/tests/multiIncremental/pr121384/base/moodytest/AnnotationMoodyImplementor.java @@ -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 index 000000000..6fca1bebb --- /dev/null +++ b/tests/multiIncremental/pr121384/base/moodytest/Mood.java @@ -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 index 000000000..332bf8585 --- /dev/null +++ b/tests/multiIncremental/pr121384/inc1/moodytest/AnnotationMoodTester.java @@ -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()); + } +} -- 2.39.5