@SuppressWarnings({"rawtypes", "unchecked"})
  public void classifyVarConn() {
    System.out.println("[classify] starting...");
    Collection<HashSet> groups = varConn.findConnectedComponents();
    Collection<Set> refactorableGroups = new HashSet();
    Set<String> noRefactorableClsNameInRG = new HashSet<String>();
    for (Set c : groups) {
      Set clsNames = getClassNamesInGroup(c);
      if (clsNames.size() == 1) {
        Set<SootField> clsFields = protectedFieldsInAllClass.get(clsNames.iterator().next());
        if (clsFields != null && !c.containsAll(clsFields)) {
          refactorableGroups.add(c);
        }
      }
    }
    for (Set c : refactorableGroups) {
      SootField sf = (SootField) c.iterator().next();
      String clsName = sf.getDeclaringClass().getName();
      Collection fieldsModules = refactorableClass.get(clsName);
      if (fieldsModules == null) {
        fieldsModules = new HashSet();
        refactorableClass.put(clsName, fieldsModules);
      }
      fieldsModules.add(c);
    }

    for (Entry entry : refactorableClass.entrySet()) {
      if (((Collection) entry.getValue()).size() == 1) {
        noRefactorableClsNameInRG.add((String) entry.getKey());
      }
    }
    for (String s : noRefactorableClsNameInRG) {
      Collection c = refactorableClass.get(s);
      if (c != null) {
        refactorableClass.remove(s);
      }
    }
  }
  public void buildVarConn(Collection<JavaCriticalSection> validSyncs) {
    scaner = new FieldScaner(allInvolvedMethod);
    for (JavaCriticalSection cs : validSyncs) {
      SootMethod m = cs.getSootMethod();
      if (m == null) continue;
      Set<SootField> fields = null;
      if (cs.getSynType() == SyncType.SyncMethod) {
        fields = scaner.getUseInstanceFields(m);
        if (fields != null && needMod) fields.addAll(scaner.getModInstanceFields(m));
        fields = filter(cs, fields);
        everyMethodFields.put(cs.getMethodName(), fields);
      } // synchronization is a block
      else {
        fields = collectBlockField(cs);
        fields = filter(cs, fields);
        everyBlockFields.put(cs.getMethodName(), fields);
      }

      // -------------------------------------addEdges-----------------------------------

      String clsName = cs.getClassNameOfSourceFile();
      if (!protectedFieldsInAllClass.containsKey(clsName)) {
        protectedFieldsInAllClass.put(clsName, new HashSet());
      }
      protectedFieldsInAllClass.get(clsName).addAll(fields);

      SootField[] fs = fields.toArray(new SootField[0]);
      for (int i = 0; i < fs.length; i++) {
        Set<SootField> neighbors = new HashSet();
        for (int j = 0; j < fs.length; j++) {
          if (i == j) continue;
          neighbors.add(fs[j]);
        }
        varConn.add(fs[i], neighbors);
      }
    }
  }