aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs163
diff options
context:
space:
mode:
authoraclement <aclement>2008-12-03 22:48:10 +0000
committeraclement <aclement>2008-12-03 22:48:10 +0000
commit2c41499e77a0f11a226edf1255a7b025dd3a4131 (patch)
treec1bea5f60d78a351d3016c1297c040c05f5f46ff /tests/bugs163
parente65202e30fccf3ef5a796d667a821ed1113c1314 (diff)
downloadaspectj-2c41499e77a0f11a226edf1255a7b025dd3a4131.tar.gz
aspectj-2c41499e77a0f11a226edf1255a7b025dd3a4131.zip
164016: testcode
Diffstat (limited to 'tests/bugs163')
-rw-r--r--tests/bugs163/pr164016/Code.aj71
1 files changed, 71 insertions, 0 deletions
diff --git a/tests/bugs163/pr164016/Code.aj b/tests/bugs163/pr164016/Code.aj
new file mode 100644
index 000000000..e60f09936
--- /dev/null
+++ b/tests/bugs163/pr164016/Code.aj
@@ -0,0 +1,71 @@
+package test;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.DeclareParents;
+
+interface A {
+ void doA();
+}
+
+interface BBad extends A {
+ void doB();
+}
+
+interface BGood extends A {
+ void doB();
+ void doA();
+}
+
+class TargetBad { }
+class TargetGood { }
+
+@Aspect
+ class DeclareParentsAspect {
+
+// @DeclareParents(value = "test.TargetGood", defaultImpl = BImplGood.class)
+ // private BGood bGood;
+
+ @DeclareParents(value = "test.TargetBad", defaultImpl = BImplGood.class)
+ private BBad bBad;
+
+ public static class BImplGood implements BGood, BBad {
+
+ public void doB() {
+ System.out.println("doB");
+ }
+
+ public void doA() {
+ System.out.println("doA");
+ }
+ }
+}
+
+public class Code {
+ public static void main(String... args) {
+/*
+ {
+ TargetGood target = new TargetGood();
+ BGood b = (BGood) target;
+ b.doB();
+ b.doA();
+ }
+*/
+ {
+ TargetBad target = new TargetBad();
+ BBad b = (BBad) target;
+ b.doB();
+
+ /*
+ The following line is the problem.
+ The Generated class should refer to ajc$test_DeclareParentsAspect$test_BBad
+
+ Instead...
+
+ Exception in thread "main" java.lang.NoSuchFieldError: ajc$test_DeclareParentsAspect$test_A
+ at test.TargetBad.doA(TargetBad.java:1)
+ at test.Main.main(Main.java:21)
+ */
+ b.doA();
+ }
+ }
+
+}