changes: fixes the case that a shared location appears in the middle of a composite...
[IRC.git] / Robust / src / Analysis / SSJava / SSJavaAnalysis.java
index 8491529509a205117f0417d0553829409fefb615..adf303d533a74f549615468aa7e2591430ad0ced 100644 (file)
@@ -134,13 +134,12 @@ public class SSJavaAnalysis {
   public void doCheck() {
     doMethodAnnotationCheck();
 
-    if (state.SSJAVA) {
+    if (state.SSJAVA && !state.SSJAVAINFER) {
       computeLinearTypeCheckMethodSet();
       doLinearTypeCheck();
+      init();
     }
 
-    init();
-
     if (state.SSJAVADEBUG) {
       // debug_printAnnotationRequiredSet();
     }
@@ -155,7 +154,7 @@ public class SSJavaAnalysis {
     }
   }
 
-  private void init() {
+  public void init() {
     // perform topological sort over the set of methods accessed by the main
     // event loop
     Set<MethodDescriptor> methodDescriptorsToAnalyze = new HashSet<MethodDescriptor>();
@@ -346,15 +345,23 @@ public class SSJavaAnalysis {
 
   public <T> void writeLatticeDotFile(ClassDescriptor cd, MethodDescriptor md,
       SSJavaLattice<T> locOrder) {
+    writeLatticeDotFile(cd, md, locOrder, "");
+
+  }
+
+  public <T> void writeLatticeDotFile(ClassDescriptor cd, MethodDescriptor md,
+      SSJavaLattice<T> locOrder, String nameSuffix) {
 
     String fileName = "lattice_";
     if (md != null) {
       fileName +=
-          cd.getSymbol().replaceAll("[\\W_]", "") + "_" + md.getSymbol().replaceAll("[\\W_]", "");
+          cd.getSymbol().replaceAll("[\\W_]", "") + "_" + md.toString().replaceAll("[\\W_]", "");
     } else {
       fileName += cd.getSymbol().replaceAll("[\\W_]", "");
     }
 
+    fileName += nameSuffix;
+
     Set<Pair<T, T>> pairSet = locOrder.getOrderingPairSet();
 
     if (pairSet.size() > 0) {
@@ -458,7 +465,7 @@ public class SSJavaAnalysis {
         locOrder.put(higherLoc, lowerLoc);
         if (locOrder.isIntroducingCycle(higherLoc)) {
           throw new Error("Error: the order relation " + lowerLoc + " < " + higherLoc
-              + " introduces a cycle.");
+              + " introduces a cycle in the class lattice " + cd);
         }
       } else if (orderElement.contains("*")) {
         // spin loc definition