Ejemplo n.º 1
0
  public static SootClass mockSootClass(String clsName) {
    SootClass sc = null;

    if (Scene.v().containsClass(clsName)) {
      sc = Scene.v().getSootClass(clsName);

      if (sc.isPhantom()) {
        // sc.setPhantom(false);
        sc.setApplicationClass();
        sc.setInScene(true);

        try {
          for (Field field : sc.getClass().getFields()) {
            if (field.getName().equals("isPhantom")) {
              field.setAccessible(true);
              field.setBoolean(sc, false);
            }
          }
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    } else {
      sc = new SootClass(clsName);
      sc.setSuperclass(Scene.v().getSootClass("java.lang.Object"));

      sc.setPhantom(false);
      sc.setApplicationClass();
      sc.setInScene(true);
    }

    mockConstructor(sc);

    return sc;
  }
  public static SootClass createSootClass(String clsName) {
    SootClass sc = new SootClass(clsName);
    sc.setSuperclass(Scene.v().getSootClass("java.lang.Object"));

    sc.setApplicationClass();
    sc.setPhantom(false);
    sc.setInScene(true);

    return sc;
  }