diff --git a/src/org/ntlab/deltaViewer/CollaborationLayout.java b/src/org/ntlab/deltaViewer/CollaborationLayout.java index bf3aad3..76674f9 100644 --- a/src/org/ntlab/deltaViewer/CollaborationLayout.java +++ b/src/org/ntlab/deltaViewer/CollaborationLayout.java @@ -83,7 +83,7 @@ } // Extract the reference access history. - List references = objectCallGraph.getReferences(); + List references = new ArrayList<>(objectCallGraph.getReferences()); Map> referenceHistory = new HashMap<>(); int order = 0; for (Alias a: aliasCollector.getAliasList()) { @@ -106,13 +106,28 @@ } else if (a.getAliasType() == AliasType.RETURN_VALUE) { MethodExecution methodExec = a.getMethodExecution(); if (methodExec.getSignature().contains("List.get(") || - methodExec.getSignature().contains("Map.get(")) { + methodExec.getSignature().contains("Map.get(") || + methodExec.getSignature().contains(".next()") || + methodExec.getSignature().contains(".iterator()") || + methodExec.getSignature().contains(".listIterator()")) { String srcObjId = methodExec.getThisObjId(); String dstObjId = methodExec.getReturnValue().getId(); String srcClassName = methodExec.getThisClassName(); String dstClassName = methodExec.getReturnValue().getActualType(); idx = references.indexOf(new Reference(srcObjId, dstObjId, srcClassName, dstClassName)); - } + } else if (methodExec.isStatic() && methodExec.getCallerMethodExecution().isStatic()) { + // For calls from a static method to another static method. + String dstClassName = methodExec.getThisClassName(); + String srcClassName = methodExec.getCallerMethodExecution().getThisClassName(); + String dstObjId = methodExec.getThisObjId() + ":" + dstClassName; + String srcObjId = methodExec.getCallerMethodExecution().getThisObjId() + ":" + srcClassName; + Reference r = new Reference(srcObjId, dstObjId, srcClassName, dstClassName); + idx = references.indexOf(r); + if (idx < 0) { + references.add(r); + idx = references.indexOf(r); + } + } } else if (a.getAliasType() == AliasType.CONSTRACTOR_INVOCATION) { MethodInvocation c = (MethodInvocation) a.getOccurrencePoint().getStatement(); String srcObjId = a.getMethodExecution().getThisObjId();