aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2009-04-30 19:51:46 +0000
committeraclement <aclement>2009-04-30 19:51:46 +0000
commitc533722181596ca6ed43fbc87c28936961c46570 (patch)
tree50b38827a6b243ee38ddbd0e2672445aadcdbc44
parentaeaa12757ee7691b9deda9a07c921c83dd9a6032 (diff)
downloadaspectj-c533722181596ca6ed43fbc87c28936961c46570.tar.gz
aspectj-c533722181596ca6ed43fbc87c28936961c46570.zip
274558: use .class names in handles for binaries entries (faulted in aspects)
-rw-r--r--tests/multiIncremental/bug274558base/base/src/p/HasITDs1.java7
-rw-r--r--tests/multiIncremental/bug274558base/base/src/q/UsesITDs1.java15
-rw-r--r--tests/multiIncremental/bug274558depending/base/src/r/DeclaresITD.aj9
-rw-r--r--tests/multiIncremental/bug274558depending/base/src/r/HasITDs2.java5
-rw-r--r--tests/multiIncremental/bug274558depending/base/src/r/InterfaceForITD.java5
-rw-r--r--tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java12
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java40
7 files changed, 83 insertions, 10 deletions
diff --git a/tests/multiIncremental/bug274558base/base/src/p/HasITDs1.java b/tests/multiIncremental/bug274558base/base/src/p/HasITDs1.java
new file mode 100644
index 000000000..0567357cc
--- /dev/null
+++ b/tests/multiIncremental/bug274558base/base/src/p/HasITDs1.java
@@ -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
index 000000000..6eb6f0b4a
--- /dev/null
+++ b/tests/multiIncremental/bug274558base/base/src/q/UsesITDs1.java
@@ -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
index 000000000..b31740ed5
--- /dev/null
+++ b/tests/multiIncremental/bug274558depending/base/src/r/DeclaresITD.aj
@@ -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
index 000000000..1333038c4
--- /dev/null
+++ b/tests/multiIncremental/bug274558depending/base/src/r/HasITDs2.java
@@ -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
index 000000000..3a549f7dc
--- /dev/null
+++ b/tests/multiIncremental/bug274558depending/base/src/r/InterfaceForITD.java
@@ -0,0 +1,5 @@
+package r;
+
+public interface InterfaceForITD {
+
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java b/tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java
index bc78b7108..518b72182 100644
--- a/tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc164/Ajc164Tests.java
@@ -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)));
diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
index 9df461b07..ab18d15fc 100644
--- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
+++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
@@ -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";