diff --git a/src/org/ntlab/deltaViewer/CollaborationLayout.java b/src/org/ntlab/deltaViewer/CollaborationLayout.java index 0cc39a0..6b428c8 100644 --- a/src/org/ntlab/deltaViewer/CollaborationLayout.java +++ b/src/org/ntlab/deltaViewer/CollaborationLayout.java @@ -77,8 +77,17 @@ for (Alias a: aliasCollector.getAliasList()) { int idx = -1; if (a.getAliasType() == AliasType.FIELD) { - FieldAccess f = (FieldAccess) a.getOccurrencePoint().getStatement(); - idx = references.indexOf(new Reference(f.getContainerObjId(), f.getValueObjId(), f.getContainerClassName(), f.getValueClassName())); + Reference ref = null; + if (a.getOccurrencePoint().getStatement() instanceof FieldAccess) { + FieldAccess f = (FieldAccess) a.getOccurrencePoint().getStatement(); + ref = new Reference(f.getContainerObjId(), f.getValueObjId(), f.getContainerClassName(), f.getValueClassName()); + } else if (a.getOccurrencePoint().getStatement() instanceof MethodInvocation) { + // A call to an enclosing instance. + MethodExecution m = a.getMethodExecution(); + MethodInvocation i = (MethodInvocation) a.getOccurrencePoint().getStatement() ; + ref = new Reference(m.getThisObjId(), a.getObjectId(), m.getThisClassName(), i.getCalledMethodExecution().getArguments().get(0).getActualType()); + } + idx = references.indexOf(ref); } else if (a.getAliasType() == AliasType.ARRAY_ELEMENT) { ArrayAccess aa = (ArrayAccess) a.getOccurrencePoint().getStatement(); idx = references.indexOf(new Reference(aa.getArrayObjectId(), aa.getValueObjectId(), aa.getArrayClassName(), aa.getValueClassName()));