final List<MethodSignature> transformConstructorsCalled = new ArrayList<MethodSignature>();
final DBSetSourceChecker checkDBSets = new DBSetSourceChecker(entityInfo);
final Set<TypedValue> unresolvedDBSets = new HashSet<TypedValue>();
ConditionRecorder pathConditions = new ConditionRecorder();
BasicSymbolicInterpreter interpreter = new SymbolicInterpreterWithFieldAccess(Opcodes.ASM5);
FrameWithHelpers frame = new FrameWithHelpers(cl, m, interpreter);
interpreter.setFrameForAliasingFixups(frame);
interpreter.setBranchHandler(pathConditions);
interpreter.setMethodChecker(new BasicSymbolicInterpreter.MethodChecker() {
public boolean isStaticMethodSafe(MethodSignature m)
{ return safeStaticMethods.contains(m); }
public boolean isMethodSafe(MethodSignature m, TypedValue base, List<TypedValue> args)
{
if (m.name.equals("<init>") && otherTransformClasses.contains(m.owner))
{
transformConstructorsCalled.add(m);
return true;
}
else if (entityInfo.dbSetMethods.contains(m))
{
Type[] argTypes = Type.getArgumentTypes(m.desc);
try {
base.visit(checkDBSets, unresolvedDBSets);
for (int n = 0; n < argTypes.length; n++)
{
Type t = argTypes[n];
if (t.getSort() != Type.OBJECT) continue;
if (!t.getInternalName().equals("Lch/epfl/labos/iu/orm/DBSet;")) continue;
args.get(n).visit(checkDBSets, unresolvedDBSets);
}
} catch (TypedValueVisitorException e)
{
return false;
}
return true;
}
else
return safeMethods.contains(m);
}});
for (PathInstruction instruction: path)
{
// Skip "fake" instructions like Frame, LineNumber, and Label
if (instruction.node.getOpcode() < 0) continue;
if (instruction.isBranch)
pathConditions.isBranchTaken = instruction.isBranchTaken;
frame.execute(instruction.node, interpreter);
}
TypedValue returnValue = interpreter.returnValue;
List<TypedValue.ComparisonValue> conditions = pathConditions.conditions;