a bug fix...
authoryeom <yeom>
Mon, 18 Feb 2013 19:36:04 +0000 (19:36 +0000)
committeryeom <yeom>
Mon, 18 Feb 2013 19:36:04 +0000 (19:36 +0000)
Robust/src/Analysis/SSJava/BuildLattice.java
Robust/src/Analysis/SSJava/LocationInference.java
Robust/src/Util/Lattice.java

index 7a38272d4fd3d67c84a9bac1a92868f5f7aeb002..61a083274e84e97c7968442d8bc6d5d502d343f8 100644 (file)
@@ -276,6 +276,7 @@ public class BuildLattice {
           if (hNode.isCombinationNode()) {
             Set<HNode> combineSkeletonNodeSet =
                 hierarchyGraph.getCombineSetByCombinationNode(hNode);
+
             aboveSet.addAll(hierarchyGraph
                 .getFirstNodeOfCombinationNodeChainSet(combineSkeletonNodeSet));
             SCNode = scGraph.getCombinationNode(combineSkeletonNodeSet);
@@ -288,9 +289,16 @@ public class BuildLattice {
             SCNode = aboveSet.iterator().next();
           }
 
-          numNonSharedNodes = hierarchyGraph.countNonSharedNode(hNode, aboveSet);
+          // update above set w.r.t the hierarchy graph with SC nodes
+          // because the skeleton nodes in the origianl hierarchy graph may merged to a new node
+          Set<HNode> endSet = new HashSet<HNode>();
+          for (Iterator iterator2 = aboveSet.iterator(); iterator2.hasNext();) {
+            HNode aboveNode = (HNode) iterator2.next();
+            endSet.add(scGraph.getCurrentHNode(aboveNode));
+          }
+          numNonSharedNodes = hierarchyGraph.countNonSharedNode(hNode, endSet);
 
-          System.out.println("   node=" + hNode + " above=" + aboveSet + " distance="
+          System.out.println("   node=" + hNode + " above=" + endSet + " distance="
               + numNonSharedNodes + "   SCNode=" + SCNode);
         }
 
@@ -326,6 +334,7 @@ public class BuildLattice {
 
   private String recur_getNewLocation(SSJavaLattice<String> lattice, String cur,
       Set<String> endSet, int dist, boolean isShared) {
+    System.out.println("H");
     Set<String> connectedSet = lattice.get(cur);
     if (connectedSet == null) {
       connectedSet = new HashSet<String>();
index caa4504a13c5e29cf88e7ed2c523e1bb5f9f9876..b15742f55874221a52703f4ddf5653a6cb7b39fa 100644 (file)
@@ -2607,7 +2607,15 @@ public class LocationInference {
 
     addMapDescToSimpleLattice(desc, simpleLattice);
 
+    if (desc instanceof ClassDescriptor) {
+      writeInferredLatticeDotFile((ClassDescriptor) desc, null, simpleLattice, "_SC");
+    } else {
+      MethodDescriptor md = (MethodDescriptor) desc;
+      writeInferredLatticeDotFile(md.getClassDesc(), md, simpleLattice, "_SC");
+    }
+
     HierarchyGraph simpleHierarchyGraph = getSimpleHierarchyGraph(desc);
+
     // System.out.println("\n## insertIntermediateNodesToStraightLine:"
     // + simpleHierarchyGraph.getName());
     SSJavaLattice<String> lattice =
index b76b7bb0185f4ca7ee3fef7031f7792843d99e09..0418d237b3d7645a3fbf0582fe4d18350cb58098 100644 (file)
@@ -66,12 +66,12 @@ public class Lattice<T> {
   }
 
   public boolean put(T key, T value) {
-    
-    if(isGreaterThan(key, value)){
+
+    if (isComparable(key, value) && isGreaterThan(key, value)) {
       // this relation already exists
       return false;
     }
-    
+
     Set<T> s;
 
     Set<T> topNeighbor = table.get(top);
@@ -95,10 +95,9 @@ public class Lattice<T> {
       }
 
       // if value is already connected with top, it is no longer to be
-      if(!key.equals(top)){
-        topNeighbor.remove(value);  
+      if (!key.equals(top)) {
+        topNeighbor.remove(value);
       }
-      
 
       // if key is already connected with bottom,, it is no longer to be
       if (!value.equals(getBottomItem())) {