bug fix: if a parent class doesn't define lattice, we don't need to check whether...
authoryeom <yeom>
Tue, 12 Jul 2011 22:14:10 +0000 (22:14 +0000)
committeryeom <yeom>
Tue, 12 Jul 2011 22:14:10 +0000 (22:14 +0000)
Robust/src/Analysis/SSJava/FlowDownCheck.java

index 108ad0dc8d0c5eda947ad7ec8dc181e1b869e927..c108946be42299ec8ed682bd3269abf7442fc4ee 100644 (file)
@@ -148,23 +148,29 @@ public class FlowDownCheck {
     SSJavaLattice<String> superLattice = ssjava.getClassLattice(superCd);
     SSJavaLattice<String> subLattice = ssjava.getClassLattice(cd);
 
-    if (superLattice != null && subLattice == null) {
-      throw new Error("If a parent class '" + superCd + "' has a ordering lattice, its subclass '"
-          + cd + "' should have one.");
-    }
+    if (superLattice != null) {
+
+      if (subLattice == null) {
+        throw new Error("If a parent class '" + superCd
+            + "' has a ordering lattice, its subclass '" + cd + "' should have one.");
+      }
 
-    Set<Pair<String, String>> superPairSet = superLattice.getOrderingPairSet();
-    Set<Pair<String, String>> subPairSet = subLattice.getOrderingPairSet();
+      Set<Pair<String, String>> superPairSet = superLattice.getOrderingPairSet();
+      Set<Pair<String, String>> subPairSet = subLattice.getOrderingPairSet();
 
-    for (Iterator iterator = superPairSet.iterator(); iterator.hasNext();) {
-      Pair<String, String> pair = (Pair<String, String>) iterator.next();
+      for (Iterator iterator = superPairSet.iterator(); iterator.hasNext();) {
+        Pair<String, String> pair = (Pair<String, String>) iterator.next();
 
-      if (!subPairSet.contains(pair)) {
-        throw new Error("Subclass '" + cd + "' does not have the relative ordering '"
-            + pair.getSecond() + " < " + pair.getFirst() + "' that is defined by its superclass '"
-            + superCd + "'.");
+        if (!subPairSet.contains(pair)) {
+          throw new Error("Subclass '" + cd + "' does not have the relative ordering '"
+              + pair.getSecond() + " < " + pair.getFirst()
+              + "' that is defined by its superclass '" + superCd + "'.");
+        }
       }
+
     }
+    // if super class doesn't define lattice, then we don't need to check its
+    // subclass
 
   }