protected SootMethod createFakeStructRetMethod(SootMethod originalMethod) { // Create a new method with the same parameters but a @StructRet parameter inserted first @SuppressWarnings("unchecked") ArrayList<soot.Type> newParameterTypes = new ArrayList<soot.Type>(originalMethod.getParameterTypes()); newParameterTypes.add(0, originalMethod.getReturnType()); SootMethod method = new SootMethod( originalMethod.getName(), newParameterTypes, VoidType.v(), originalMethod.getModifiers()); method.setDeclaringClass(originalMethod.getDeclaringClass()); method.setDeclared(true); // Copy all annotations from the original method copyAnnotations(originalMethod, method, Visibility.Any); // Copy all parameter annotations from the original method to the copy shifting by 1 copyParameterAnnotations( originalMethod, method, 0, originalMethod.getParameterCount(), 1, Visibility.Any); // Add @StructRet to parameter 0 addRuntimeVisibleParameterAnnotation(method, 0, STRUCT_RET); return method; }