Skip to content

UnsafeAccess supports jre w/o Unsafe.getByte, e.g. Android API 19-23#35

Merged
dpisklov merged 2 commits intoOpenHFT:masterfrom
gzm55:work/android-6
Feb 24, 2020
Merged

UnsafeAccess supports jre w/o Unsafe.getByte, e.g. Android API 19-23#35
dpisklov merged 2 commits intoOpenHFT:masterfrom
gzm55:work/android-6

Conversation

@gzm55
Copy link
Copy Markdown
Collaborator

@gzm55 gzm55 commented Feb 23, 2020

On some old java runtime, e.g. in Android API level 19~23, the class Unsafe has no getByte() nor getShort() methods. In this case, we can indirectly get results by getInt() to first read a larger piece of memory.

When calculating hash, we do not read from the Java object headers, so getInt(o, offset - 3) is safe.

Fix #33 .

@gzm55 gzm55 changed the title UnsafeAccess jre w/o Unsafe.getByte, e.g. Android API 19-23 UnsafeAccess supports jre w/o Unsafe.getByte, e.g. Android API 19-23 Feb 23, 2020
@dpisklov dpisklov merged commit 39ae9cc into OpenHFT:master Feb 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NoSuchMethodError for android 6

2 participants