Esempio n. 1
0
 @SuppressWarnings("unchecked")
 public static FunctionType getFunctionType(SootMethodRef methodRef) {
   Type returnType = getType(methodRef.returnType());
   Type[] paramTypes =
       new Type[(methodRef.isStatic() ? 1 : 2) + methodRef.parameterTypes().size()];
   int i = 0;
   paramTypes[i++] = ENV_PTR;
   if (!methodRef.isStatic()) {
     paramTypes[i++] = OBJECT_PTR;
   }
   for (soot.Type t : (List<soot.Type>) methodRef.parameterTypes()) {
     paramTypes[i++] = getType(t);
   }
   return new FunctionType(returnType, paramTypes);
 }
 private SootMethodRef remapRef(SootMethodRef ref) {
   Type return_type = fixType(ref.returnType());
   List params = fixParameterList(ref.parameterTypes());
   int modifiers = Modifier.PUBLIC;
   if (ref.isStatic()) {
     modifiers += Modifier.STATIC;
   }
   SootMethod method = new SootMethod(ref.name(), params, return_type, modifiers);
   SootClass decl_class = ref.declaringClass();
   if (shouldMap(decl_class)) {
     decl_class = getMapping(decl_class);
   }
   method.setDeclaringClass(decl_class);
   return method.makeRef();
 }
Esempio n. 3
0
  public void outAStaticInvokeExpr(AStaticInvokeExpr node) {
    List args;

    if (node.getArgList() != null) args = (List) mProductions.removeLast();
    else args = new ArrayList();

    SootMethodRef method = (SootMethodRef) mProductions.removeLast();
    method =
        Scene.v()
            .makeMethodRef(
                method.declaringClass(),
                method.name(),
                method.parameterTypes(),
                method.returnType(),
                true);

    mProductions.addLast(Jimple.v().newStaticInvokeExpr(method, args));
  }
Esempio n. 4
0
 @SuppressWarnings("unchecked")
 public static String getDescriptor(SootMethodRef methodRef) {
   return getDescriptor(methodRef.parameterTypes(), methodRef.returnType());
 }