if (!sc.declaresMethodByName(SootMethod.staticInitializerName)) { SootMethod m = Scene.v().makeSootMethod(SootMethod.staticInitializerName, emptyList(), VoidType.v(), Modifier.STATIC); sc.addMethod(m);
final boolean addStaticInitializer = !sootClass.declaresMethodByName(SootMethod.staticInitializerName); final Body body; if (addStaticInitializer) {
@Override protected void createEmptyMainMethod() { // Make sure that we don't end up with duplicate method names int methodIdx = exceptionThrowers.size(); String methodName; do { methodName = "throw" + methodIdx++; } while (exceptionClass.declaresMethodByName(methodName)); // Create the new method SootMethod thrower = Scene.v().makeSootMethod(methodName, Collections.<Type>emptyList(), VoidType.v()); thrower.setModifiers(Modifier.PUBLIC | Modifier.STATIC); final Body body = Jimple.v().newBody(thrower); thrower.setActiveBody(body); // Register the new method exceptionThrowers.put(t.getException(), thrower); exceptionClass.addMethod(thrower); // Make it available to the entry point creator mainMethod = thrower; }
SootClass mainClass = Scene.v().getSootClass(dummyClassName); if (!overwriteDummyMainMethod) while (mainClass.declaresMethodByName(methodName)) methodName = baseMethodName + "_" + methodIndex++;
if (declaringClass.declaresMethodByName("<clinit>")) {
/** * Get a method that returns an unknown value of type t. * * @param t * @return */ public SootMethod getHavocMethod(soot.Type t) { if (!Scene.v().containsClass(HavocClassName)) { SootClass sClass = new SootClass(HavocClassName, Modifier.PUBLIC | Modifier.PUBLIC); sClass.setSuperclass(Scene.v().getSootClass("java.lang.Object")); sClass.setResolvingLevel(SootClass.SIGNATURES); Scene.v().addClass(sClass); } SootClass cls = Scene.v().getSootClass(HavocClassName); final String havocMethodName = HavocMethodName + t.toString(); if (!cls.declaresMethodByName(havocMethodName)) { cls.addMethod(new SootMethod(havocMethodName, Arrays.asList(new Type[] {}), t, Modifier.PUBLIC | Modifier.STATIC)); } return cls.getMethodByName("havoc_" + t.toString()); }
if (! refType.getSootClass().declaresMethodByName(arraySetName)) refType = objArRepl; if (! refType.getSootClass().declaresMethodByName(arrayGetName)) refType = objArRepl; if (! arrayClass.declaresMethodByName(arraySetName)) arrayClass = objArRepl.getSootClass();
mainClass = Scene.v().getSootClass(dummyClassName); if (!overwriteDummyMainMethod) while (mainClass.declaresMethodByName(methodName)) methodName = dummyMethodName + "_" + methodIndex++; } else {