type array reference as Object in local type.

Fixes issue 120

--HG--
branch : 0.0.9.x
This commit is contained in:
Panxiaobo 2012-06-11 11:03:44 +08:00
parent c29ccd1d79
commit 4cda0b365d
2 changed files with 3 additions and 2 deletions

View File

@ -172,6 +172,7 @@ public class LocalType implements Transformer {
case LENGTH: {
UnopExpr te = (UnopExpr) v;
exec(te.op.value);
type(te.op.value, Type.getType(Object.class));
type(tb, Type.INT_TYPE);
}
break;

View File

@ -22,10 +22,10 @@ public class I120Test {
DexMethodVisitor mv = cv.visitMethod(ACC_PUBLIC | ACC_STATIC, new Method("La;", "b", new String[] {}, "V"));
DexCodeVisitor code = mv.visitCode();
code.visitArguments(3, new int[] {});
code.visitConstStmt(OP_CONST, 0, Integer.valueOf(0), TYPE_SINGLE); // int: 0xffffffff float:NaN
code.visitConstStmt(OP_CONST, 0, Integer.valueOf(0), TYPE_SINGLE);
code.visitMethodStmt(OP_INVOKE_VIRTUAL, new int[] { 0 }, new Method("Ljava/lang/String;", "toString",
new String[] {}, "Ljava/lang/String;"));
code.visitConstStmt(OP_CONST, 1, Integer.valueOf(0), TYPE_SINGLE); // int: 0xffffffff float:NaN
code.visitConstStmt(OP_CONST, 1, Integer.valueOf(0), TYPE_SINGLE);
code.visitUnopStmt(OP_ARRAY_LENGTH, 2, 1, TYPE_INT);
code.visitReturnStmt(OP_RETURN_VOID);
code.visitEnd();