What steps will reproduce the problem?
1. Write a Java program which includes the following code snippet:
String str = null;
str.trim();
int[] ar = null;
a.length
2. Compile using dx to get the following dex code:
const/4 v0, 0x0
invoke-virtual {v0}, Ljava/lang/String;->trim()Ljava/lang/String;
const/4 v1, 0x0
array-length v2, v1
3. Use dexjar to convert to jar.
What is the expected output? What do you see instead?
Expected java bytecode is:
aconst_null
invokevirtual #18; //Method java/lang/String.trim:()Ljava/lang/String;
aconst_null
arraylength
What I get is:
aconst_null
invokevirtual #18; //Method java/lang/String.trim:()Ljava/lang/String;
iconst_0
arraylength
What version of the product are you using? On what operating system?
dex2jar-0.0.9.5 in MAC OSX 10.6.8
Please provide any additional information below.
Dex does not have NULL so when dx is run all array/object assignments with NULL
are replaced with assignments of 0. This is not a problem for dalvik. When
dex2jar is used to translate to jar it has to fix this as the distinction of 0
and NULL is important in Java.
Dex2jar only fixes the above problem for object references, but not for array
references as can be seen from the code snippets.
Original issue reported on code.google.com by O.Tsapo...@gmail.com on 10 Jun 2012 at 5:19
Original issue reported on code.google.com by
O.Tsapo...@gmail.com
on 10 Jun 2012 at 5:19