* 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");
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));
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));
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)));
}
// 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);
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();
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";