}
}
for (Iterator methods = theClass.getMethods().iterator(); methods
.hasNext();) {
SootMethod method = (SootMethod) methods.next();
System.out.println("processing method = " + method);
// Grab the classes of all arguments.
for (Iterator types = method.getParameterTypes().iterator(); types
.hasNext();) {
Type type = (Type) types.next();
if (type instanceof RefType) {
_addClass(((RefType) type).getSootClass());
}
}
// Grab the method return types.
{
Type type = method.getReturnType();
if (type instanceof RefType) {
_addClass(((RefType) type).getSootClass());
}
}
// Don't drag in the bodies of abstract methods.
if (!method.isConcrete()) {
continue;
}
JimpleBody body = (JimpleBody) method.retrieveActiveBody();
Scene.v().releaseActiveHierarchy();
// Grab the types of all traps.
for (Iterator it = body.getTraps().iterator(); it.hasNext();) {
Trap t = (Trap) it.next();
_addClass(t.getException());
}
// Grab the classes of all referenced fields, invoked
// methods, and created classes.
for (Iterator units = body.getUnits().iterator(); units.hasNext();) {
Unit unit = (Unit) units.next();
for (Iterator boxes = unit.getUseAndDefBoxes().iterator(); boxes
.hasNext();) {
ValueBox box = (ValueBox) boxes.next();
Value value = box.getValue();
if (value instanceof FieldRef) {
SootField field = ((FieldRef) value).getField();
SootClass refClass = field.getDeclaringClass();
if (!refClass.equals(theClass)) {
_addClass(refClass);
}
} else if (value instanceof InvokeExpr) {
SootMethod refMethod = ((InvokeExpr) value).getMethod();
SootClass refClass = refMethod.getDeclaringClass();
if (!refClass.equals(theClass)) {
_addClass(refClass);
}
} else if (value instanceof NewExpr) {