-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check for String.offset < API 23 #350
Conversation
import static org.junit.Assert.fail; | ||
|
||
public class HahaHelperTest { | ||
public static final int STRING_CLASS_ID = 100; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Private static fields
LGTM. Once updated with feedback, feel free to merge. |
updated per feedback |
|
||
@Override | ||
public int readInt() { | ||
if(intsToRead == null || intIndex < 0 || intIndex >= intsToRead.length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code not properly formatted (missing space after if)
* Added check for offset field in String class for versions < API 23 * Added heap dump for M post-Preview 2 * Added unit test to cover String instance cases
updated per feedback |
Check for String.offset < API 23
As of M, the int offset and char[] value fields were removed from String.java and could not be parsed in heap dumps.
However, in Preview 2, the char buffer was still serialized in the heap dump, 16 bytes after the String address. This commit restored parsing of M Preview 2 heap dumps.
After Android M Preview 2, a virtual char[] value field was inserted in all String objects when dumping the heap. This resulted in execution of the pre-M code path which expected the "offset" field defined in the original String.java. This commit accounts for the third case.