fix: does not need to check a class that does not have any annotated method
authoryeom <yeom>
Wed, 13 Jul 2011 20:23:16 +0000 (20:23 +0000)
committeryeom <yeom>
Wed, 13 Jul 2011 20:23:16 +0000 (20:23 +0000)
Robust/src/Analysis/SSJava/FlowDownCheck.java
Robust/src/Analysis/SSJava/SSJavaAnalysis.java

index e752141d1b61b9cff557aa78db1a5eda01c3db3c..3d892067515c7036d32dab088f731dffc2d1fb50 100644 (file)
@@ -103,8 +103,8 @@ public class FlowDownCheck {
       ClassDescriptor cd = (ClassDescriptor) obj;
       toanalyze.remove(cd);
 
-      if (!cd.isInterface()) {
-
+      if (ssjava.needToBeAnnoated(cd) && (!cd.isInterface())) {
+        
         ClassDescriptor superDesc = cd.getSuperDesc();
         if (superDesc != null && (!superDesc.isInterface())
             && (!superDesc.getSymbol().equals("Object"))) {
index 7e804075c3e52476d4d510cbd5eb617ddffb3981..21ae3920f1146231f9a47a998c2d44ee79f54cda 100644 (file)
@@ -37,7 +37,7 @@ public class SSJavaAnalysis {
   FlowDownCheck flowDownChecker;
   MethodAnnotationCheck methodAnnotationChecker;
 
-  // if a method has annotations, the mapping has true
+  // set containing method requires to be annoated
   Set<MethodDescriptor> annotationRequireSet;
 
   // class -> field lattice
@@ -49,12 +49,15 @@ public class SSJavaAnalysis {
   // method -> local variable lattice
   Hashtable<MethodDescriptor, MethodLattice<String>> md2lattice;
 
-  // method set that does not have loop termination analysis
+  // method set that does not want to have loop termination analysis
   Hashtable<MethodDescriptor, Integer> skipLoopTerminate;
 
   // map shared location to its descriptors
   Hashtable<Location, Set<Descriptor>> mapSharedLocation2DescriptorSet;
 
+  // set containing a class that has at least one annoated method
+  Set<ClassDescriptor> annotationRequireClassSet;
+
   CallGraph callgraph;
 
   public SSJavaAnalysis(State state, TypeUtil tu, CallGraph callgraph) {
@@ -65,6 +68,7 @@ public class SSJavaAnalysis {
     this.cd2methodDefault = new Hashtable<ClassDescriptor, MethodLattice<String>>();
     this.md2lattice = new Hashtable<MethodDescriptor, MethodLattice<String>>();
     this.annotationRequireSet = new HashSet<MethodDescriptor>();
+    this.annotationRequireClassSet = new HashSet<ClassDescriptor>();
     this.skipLoopTerminate = new Hashtable<MethodDescriptor, Integer>();
     this.mapSharedLocation2DescriptorSet = new Hashtable<Location, Set<Descriptor>>();
   }
@@ -277,7 +281,15 @@ public class SSJavaAnalysis {
     return annotationRequireSet.contains(md);
   }
 
+  public boolean needToBeAnnoated(ClassDescriptor cd) {
+    return annotationRequireClassSet.contains(cd);
+  }
+
   public void addAnnotationRequire(MethodDescriptor md) {
+
+    // if a method requires to be annotated, class containg that method also
+    // requires to be annotated
+    annotationRequireClassSet.add(md.getClassDesc());
     annotationRequireSet.add(md);
   }