]> source.dussan.org Git - aspectj.git/commitdiff
286539: test and fix (decanno type in model)
authoraclement <aclement>
Thu, 13 Aug 2009 17:29:15 +0000 (17:29 +0000)
committeraclement <aclement>
Thu, 13 Aug 2009 17:29:15 +0000 (17:29 +0000)
tests/multiIncremental/pr286539/base/src/p/q/Aspect.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java

diff --git a/tests/multiIncremental/pr286539/base/src/p/q/Aspect.java b/tests/multiIncremental/pr286539/base/src/p/q/Aspect.java
new file mode 100644 (file)
index 0000000..5b33da1
--- /dev/null
@@ -0,0 +1,26 @@
+package p.q.r;
+import java.lang.annotation.*;
+
+aspect Asp {
+
+declare parents: C implements p.q.r.Int;
+declare parents: C implements Int;
+declare @type: C: @Foo;
+declare @type: C: @p.q.r.Goo;
+
+declare @field: int C.i: @Foo;
+declare @method: void C.m(): @Foo;
+declare @constructor: new(): @Foo;
+
+}
+
+@Retention(RetentionPolicy.RUNTIME) @interface Foo {}
+@Retention(RetentionPolicy.RUNTIME) @interface Goo {}
+
+interface Int {}
+
+class C {
+  int i;
+  void m() {}
+  C() {}
+}
index 9e01a5694b30e65ed25dd19ad2b55e0181c62709..5d2430edaf1bed8dcafeca65c5f92db18919b6fd 100644 (file)
@@ -138,6 +138,45 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
        // printModel(cli);
        // }
 
+       // Testing that declare annotation model entries preserve the fully qualified type of the annotation
+       public void testDecAnnoState_pr286539() throws Exception {
+               String p = "pr286539";
+               initialiseProject(p);
+               build(p);
+               printModel(p);
+               IProgramElement decpPE = getModelFor(p).getHierarchy().findElementForHandle(
+                               "=pr286539<p.q.r{Aspect.java}Asp`declare parents");
+               assertNotNull(decpPE);
+               String s = (String) (((List) decpPE.getParentTypes()).get(0));
+               assertEquals("p.q.r.Int", s);
+
+               decpPE = getModelFor(p).getHierarchy().findElementForHandle("=pr286539<p.q.r{Aspect.java}Asp`declare parents!2");
+               assertNotNull(decpPE);
+               s = (String) (((List) decpPE.getParentTypes()).get(0));
+               assertEquals("p.q.r.Int", s);
+
+               IProgramElement decaPE = getModelFor(p).getHierarchy().findElementForHandle(
+                               "=pr286539<p.q.r{Aspect.java}Asp`declare \\@type");
+               assertNotNull(decaPE);
+               assertEquals("p.q.r.Foo", decaPE.getAnnotationType());
+
+               decaPE = getModelFor(p).getHierarchy().findElementForHandle("=pr286539<p.q.r{Aspect.java}Asp`declare \\@type!2");
+               assertNotNull(decaPE);
+               assertEquals("p.q.r.Goo", decaPE.getAnnotationType());
+
+               decaPE = getModelFor(p).getHierarchy().findElementForHandle("=pr286539<p.q.r{Aspect.java}Asp`declare \\@field");
+               assertNotNull(decaPE);
+               assertEquals("p.q.r.Foo", decaPE.getAnnotationType());
+
+               decaPE = getModelFor(p).getHierarchy().findElementForHandle("=pr286539<p.q.r{Aspect.java}Asp`declare \\@method");
+               assertNotNull(decaPE);
+               assertEquals("p.q.r.Foo", decaPE.getAnnotationType());
+
+               decaPE = getModelFor(p).getHierarchy().findElementForHandle("=pr286539<p.q.r{Aspect.java}Asp`declare \\@constructor");
+               assertNotNull(decaPE);
+               assertEquals("p.q.r.Foo", decaPE.getAnnotationType());
+       }
+
        // just simple incremental build - no code change, just the aspect touched
        public void testIncrementalFqItds_280380() throws Exception {
                String p = "pr280380";