]> source.dussan.org Git - aspectj.git/commitdiff
274558: use .class names in handles for binaries entries (faulted in aspects)
authoraclement <aclement>
Thu, 30 Apr 2009 19:51:46 +0000 (19:51 +0000)
committeraclement <aclement>
Thu, 30 Apr 2009 19:51:46 +0000 (19:51 +0000)
tests/multiIncremental/bug274558base/base/src/p/HasITDs1.java [new file with mode: 0644]
tests/multiIncremental/bug274558base/base/src/q/UsesITDs1.java [new file with mode: 0644]
tests/multiIncremental/bug274558depending/base/src/r/DeclaresITD.aj [new file with mode: 0644]
tests/multiIncremental/bug274558depending/base/src/r/HasITDs2.java [new file with mode: 0644]
tests/multiIncremental/bug274558depending/base/src/r/InterfaceForITD.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java
tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java

diff --git a/tests/multiIncremental/bug274558base/base/src/p/HasITDs1.java b/tests/multiIncremental/bug274558base/base/src/p/HasITDs1.java
new file mode 100644 (file)
index 0000000..0567357
--- /dev/null
@@ -0,0 +1,7 @@
+package p;
+
+import r.InterfaceForITD;
+
+public class HasITDs1 implements InterfaceForITD {
+
+}
diff --git a/tests/multiIncremental/bug274558base/base/src/q/UsesITDs1.java b/tests/multiIncremental/bug274558base/base/src/q/UsesITDs1.java
new file mode 100644 (file)
index 0000000..6eb6f0b
--- /dev/null
@@ -0,0 +1,15 @@
+package q;
+
+import p.HasITDs1;
+import r.HasITDs2;
+
+public class UsesITDs1 {
+
+       void nothing() {
+               new HasITDs1().x++; 
+               new HasITDs2().x++;
+               new HasITDs1().nothing(1, 1, 1);
+               new HasITDs2().nothing(1, 1, 1);
+       }
+       
+}
\ No newline at end of file
diff --git a/tests/multiIncremental/bug274558depending/base/src/r/DeclaresITD.aj b/tests/multiIncremental/bug274558depending/base/src/r/DeclaresITD.aj
new file mode 100644 (file)
index 0000000..b31740e
--- /dev/null
@@ -0,0 +1,9 @@
+package r;
+
+public aspect DeclaresITD {
+       public int InterfaceForITD.x = 9;
+       
+       public void InterfaceForITD.nothing(int x, int y, int z) {
+               
+       }
+}
\ No newline at end of file
diff --git a/tests/multiIncremental/bug274558depending/base/src/r/HasITDs2.java b/tests/multiIncremental/bug274558depending/base/src/r/HasITDs2.java
new file mode 100644 (file)
index 0000000..1333038
--- /dev/null
@@ -0,0 +1,5 @@
+package r;
+
+public class HasITDs2 implements InterfaceForITD {
+
+}
diff --git a/tests/multiIncremental/bug274558depending/base/src/r/InterfaceForITD.java b/tests/multiIncremental/bug274558depending/base/src/r/InterfaceForITD.java
new file mode 100644 (file)
index 0000000..3a549f7
--- /dev/null
@@ -0,0 +1,5 @@
+package r;
+
+public interface InterfaceForITD {
+
+}
index bc78b7108214d8b0f66993de8588496bf124e9b4..518b721824560b1d6a8e2a571e2e6a7056d776cb 100644 (file)
@@ -71,6 +71,9 @@ public class Ajc164Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
         * was available as source. There are two compile steps in the xml for the test - commenting out the first will allow the source
         * handles to be seen, leaving it in will switch to binary. Effectively the only difference should be that in the binary case
         * the handles are prefixed 'binaries'.
+        * 
+        * Change due to bug 274558: now AJDT wants (blah.class as the 'source file' for the ITD so that is another difference when
+        * switching.
         */
        public void testItdsAspectPathModel_pr265729_1() {
                runTest("aspectpath model");
@@ -88,7 +91,8 @@ public class Ajc164Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
                IRelationship ir = (IRelationship) model.getRelationshipMap().get(ipe).get(0);
                String itdMethodHandle = (String) ir.getTargets().get(0);
                // handle when all source: <{Aspect.java}Aspect)Orange.getColor
-               assertEquals("/binaries<{Aspect.java}Aspect)Orange.getColor", itdMethodHandle);
+               // assertEquals("/binaries<{Aspect.java}Aspect)Orange.getColor", itdMethodHandle);
+               assertEquals("/binaries<(Aspect.class}Aspect)Orange.getColor", itdMethodHandle);
                IProgramElement itdpe = model.getHierarchy().findElementForHandle(itdMethodHandle);
                assertEquals("java.awt.Color", itdpe.getCorrespondingType(true));
 
@@ -101,7 +105,8 @@ public class Ajc164Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
                ir = (IRelationship) model.getRelationshipMap().get(ipe).get(0);
                String itdFieldHandle = (String) ir.getTargets().get(0);
                // source handle <{Aspect.java}Aspect)Strawberry.color
-               assertEquals("/binaries<{Aspect.java}Aspect)Strawberry.color", itdFieldHandle);
+               // assertEquals("/binaries<{Aspect.java}Aspect)Strawberry.color", itdFieldHandle);
+               assertEquals("/binaries<(Aspect.class}Aspect)Strawberry.color", itdFieldHandle);
                IProgramElement itdfpe = model.getHierarchy().findElementForHandle(itdMethodHandle);
                assertEquals("java.awt.Color", itdfpe.getCorrespondingType(true));
 
@@ -113,7 +118,8 @@ public class Ajc164Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
                ir = (IRelationship) model.getRelationshipMap().get(ipe).get(0);
                String itdCtorHandle = (String) ir.getTargets().get(0);
                // source handle <{Aspect.java}Aspect)Fruit.Fruit_new)QColor;)QString;
-               assertEquals("/binaries<{Aspect.java}Aspect)Fruit.Fruit_new)QColor;)QString;", itdCtorHandle);
+               // assertEquals("/binaries<{Aspect.java}Aspect)Fruit.Fruit_new)QColor;)QString;", itdCtorHandle);
+               assertEquals("/binaries<(Aspect.class}Aspect)Fruit.Fruit_new)QColor;)QString;", itdCtorHandle);
                IProgramElement itdcpe = model.getHierarchy().findElementForHandle(itdCtorHandle);
                List ptypes = itdcpe.getParameterTypes();
                assertEquals("java.awt.Color", new String((char[]) ptypes.get(0)));
index 9df461b078bb13b6edddeb57b872d236c569b1cf..ab18d15fc1dc6db28c4641b08b70a1194a481698 100644 (file)
@@ -214,9 +214,9 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
                }
                // ITD from the test program:
                // public String InterTypeAspectInterface.foo(int i,List list,App a) {
-               assertEquals("=pr265729_client/binaries<be.cronos.aop.aspects*InterTypeAspect.aj}InterTypeAspect`declare parents", h1);
+               assertEquals("=pr265729_client/binaries<be.cronos.aop.aspects(InterTypeAspect.class}InterTypeAspect`declare parents", h1);
                assertEquals(
-                               "=pr265729_client/binaries<be.cronos.aop.aspects*InterTypeAspect.aj}InterTypeAspect)InterTypeAspectInterface.foo)I)QList;)QSerializable;",
+                               "=pr265729_client/binaries<be.cronos.aop.aspects(InterTypeAspect.class}InterTypeAspect)InterTypeAspectInterface.foo)I)QList;)QSerializable;",
                                h2);
                IProgramElement binaryDecp = getModelFor(cli).getHierarchy().getElement(h1);
                assertNotNull(binaryDecp);
@@ -924,13 +924,15 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
                String loc = "";
                if (node != null) {
                        if (node.getSourceLocation() != null)
-                               loc = node.getSourceLocation().toString();
+                               loc = Integer.toString(node.getSourceLocation().getLine());
                }
-               System.out.println(node + "  [" + (node == null ? "null" : node.getKind().toString()) + "] " + loc);
+               // System.out.println(node + "  [" + (node == null ? "null" : node.getKind().toString()) + "] " + loc);
+               System.out.println(node + "  [" + (node == null ? "null" : node.getKind().toString()) + "] " + loc
+                               + (node == null ? "" : " hid:" + node.getHandleIdentifier()));
                if (node != null) {
-                       for (int i = 0; i < indent; i++)
-                               System.out.print(" ");
-                       System.out.println("  hid is " + node.getHandleIdentifier());
+                       // 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();
@@ -1006,6 +1008,30 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
                assertEquals("=AspectPathTwo/binaries<(Asp2.class}Asp2&before", findElementAtLine(root, 16).getHandleIdentifier());
        }
 
+       public void testAspectPath_pr274558() throws Exception {
+               AjdeInteractionTestbed.VERBOSE = true;
+               String base = "bug274558depending";
+               String depending = "bug274558base";
+               // addSourceFolderForSourceFile(bug2, getProjectRelativePath(bug2, "src/C.java"), "src");
+               initialiseProject(base);
+               initialiseProject(depending);
+               configureAspectPath(depending, getProjectRelativePath(base, "bin"));
+               build(base);
+               build(depending);
+               printModel(depending);
+               IProgramElement root = getModelFor(depending).getHierarchy().getRoot();
+               assertEquals("=bug274558base/binaries<r(DeclaresITD.class}DeclaresITD)InterfaceForITD.x", findElementAtLine(root, 4)
+                               .getHandleIdentifier());
+               // assertEquals("=AspectPathTwo/binaries<(Asp2.class}Asp2&before", findElementAtLine(root, 16).getHandleIdentifier());
+       }
+
+       private void printModel(String projectName) throws Exception {
+               dumptree(getModelFor(projectName).getHierarchy().getRoot(), 0);
+               PrintWriter pw = new PrintWriter(System.out);
+               getModelFor(projectName).dumprels(pw);
+               pw.flush();
+       }
+
        public void testAspectPath_pr265693() throws IOException {
                String bug = "AspectPath3";
                String bug2 = "AspectPath4";