use of com.googlecode.dex2jar.ir.stmt.Stmt.E1Stmt in project dex2jar by pxb1988.
the class ArrayNullPointerTransformer method replaceNPE.
private void replaceNPE(StmtList stmts, List<Local> locals, Stmt p) {
List<Value> values = new ArrayList<Value>();
switch(p.et) {
case E1:
tryAdd(((E1Stmt) p).op.trim(), values);
break;
case E2:
E2Stmt e2 = (E2Stmt) p;
switch(e2.op1.trim().vt) {
case LOCAL:
tryAdd(e2.op2.trim(), values);
break;
case ARRAY:
ArrayExpr ae = (ArrayExpr) e2.op1.trim();
if (tryAdd(ae.op1.trim(), values)) {
if (tryAdd(ae.op2.trim(), values)) {
tryAdd(e2.op2.trim(), values);
}
}
break;
case // putfield
FIELD:
FieldExpr fe = (FieldExpr) e2.op1.trim();
if (fe.op == null || fe.op.trim() == null || tryAdd(fe.op.trim(), values)) {
tryAdd(e2.op2.trim(), values);
}
break;
default:
if (tryAdd(e2.op2.trim(), values)) {
tryAdd(e2.op1.trim(), values);
}
}
default:
}
for (Value value : values) {
switch(value.vt) {
case CONSTANT:
case LOCAL:
break;
default:
Local n = Exprs.nLocal("xxx");
locals.add(n);
stmts.insertBefore(p, Stmts.nAssign(n, value));
}
}
stmts.insertBefore(p, Stmts.nThrow(Exprs.nInvokeNew(new Value[0], new String[0], "Ljava/lang/NullPointerException;")));
stmts.remove(p);
}
Aggregations