&& stmt.getRightOp() instanceof LengthExpr) {
if (debug) {
System.out.println("handling as length expr");
}
LengthExpr lengthExpr = (LengthExpr) stmt.getRightOp();
Local baseLocal = (Local) lengthExpr.getOp();
if (debug) {
System.out.println("operating on " + baseLocal);
}
Map fieldToReplacementArrayLocal = (Map) localToFieldToLocal
.get(baseLocal);
if (fieldToReplacementArrayLocal != null) {
doneSomething = true;
// Get the length of a random one of the replacement fields.
List replacementList = new ArrayList(
fieldToReplacementArrayLocal.keySet());
Collections.sort(replacementList, new Comparator() {
public int compare(Object o1, Object o2) {
SootField f1 = (SootField) o1;
SootField f2 = (SootField) o2;
return f1.getName().compareTo(f2.getName());
}
});
SootField field = (SootField) replacementList
.get(replacementList.size() - 1);
if (debug) {
System.out.println("replace with "
+ fieldToReplacementArrayLocal
.get(field));
}
lengthExpr
.setOp((Local) fieldToReplacementArrayLocal
.get(field));
if (debug) {
System.out.println("unit now = " + unit);