]> source.dussan.org Git - aspectj.git/commitdiff
252702: declare parents in model
authoraclement <aclement>
Thu, 30 Oct 2008 15:45:15 +0000 (15:45 +0000)
committeraclement <aclement>
Thu, 30 Oct 2008 15:45:15 +0000 (15:45 +0000)
tests/multiIncremental/decps/base/src/a/A.java [new file with mode: 0644]
tests/multiIncremental/decps/base/src/p/C.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java

diff --git a/tests/multiIncremental/decps/base/src/a/A.java b/tests/multiIncremental/decps/base/src/a/A.java
new file mode 100644 (file)
index 0000000..f1ba48d
--- /dev/null
@@ -0,0 +1,8 @@
+package a;
+import java.io.*;
+
+public aspect A {
+  declare parents: p.C implements Serializable,Goo;
+}
+
+interface Goo {}
diff --git a/tests/multiIncremental/decps/base/src/p/C.java b/tests/multiIncremental/decps/base/src/p/C.java
new file mode 100644 (file)
index 0000000..623eeda
--- /dev/null
@@ -0,0 +1,4 @@
+package p;
+
+class C {
+}
index 01e34e86ba9fcf898090322cd262bf8c8ca58957..3e81e98e0960742291c65642190347048390ca52 100644 (file)
@@ -48,6 +48,27 @@ import org.aspectj.util.FileUtil;
  */
 public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementalAjdeInteractionTestbed {
 
+       public void testDeclareParentsInModel() {
+               String p = "decps";
+               initialiseProject(p);
+               build(p);
+               IProgramElement decp = getModelFor(p).getHierarchy().findElementForHandle("=decps<a{A.java}A`declare parents");
+               List ps = decp.getParentTypes();
+               assertNotNull(ps);
+               assertEquals(2, ps.size());
+               int count = 0;
+               for (Iterator iterator = ps.iterator(); iterator.hasNext();) {
+                       String type = (String) iterator.next();
+                       if (type.equals("java.io.Serializable")) {
+                               count++;
+                       }
+                       if (type.equals("a.Goo")) {
+                               count++;
+                       }
+               }
+               assertEquals("Should have found the two types in: " + ps, 2, count);
+       }
+
        /*
         * A.aj package pack; public aspect A { pointcut p() : call( C.method before() : p() { // line 7 } }
         * 
@@ -378,6 +399,17 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
                        for (int i = 0; i < indent; i++)
                                System.out.print(" ");
                        System.out.println("  hid is " + node.getHandleIdentifier());
+                       // Map m = ((ProgramElement) node).kvpairs;
+                       // if (m != null) {
+                       // Set keys = m.keySet();
+                       // for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
+                       // Object object = (Object) iterator.next();
+                       //
+                       // for (int i = 0; i < indent; i++)
+                       // System.out.print(" ");
+                       // System.out.println("kvp: " + object + " = " + m.get(object));
+                       // }
+                       // }
                        for (Iterator i = node.getChildren().iterator(); i.hasNext();) {
                                dumptree((IProgramElement) i.next(), indent + 2);
                        }