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
Modify DefaultMethodHandler to work with Android #1436
Conversation
… 28 (Android 8) however, Android 9+ enforces more strict checking with reflection. Solution is to use double reflection, as below. Jamie (xrpdevs-at-xrpdevs-co-uk) TODO: Integrate back into version forked from, keep original legacyReadLookup and safeReadLookup and add conditional branch if running on Dalvik (android java runtime)
Previous commit did not deal with Android 9+ reflection security. Solution in Android 9 is to use double reflection. Android's JVM is detected at runtime and MethodHandle is obtained in an Android compatible way, otherwise, we run readLookup() instead.
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.
Build is not passing, so, I can't review it in details unless this is building successfully
if (System.getProperty("java.vm.name").equalsIgnoreCase("Dalvik")) { | ||
return androidLookup(declaringClass); | ||
} else { | ||
return safeReadLookup(declaringClass); |
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.
I had "readLookup" instead of "safeReadLookup" here. Building now...
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.
This is building OK now?
For some unknow reason, this is not building at all: @kdavisk6 any clue? |
Buiding locally for me without issue (IDEA/Maven) and passing CircleCi tests.
I did read this regarding merges being blocked due to how CircleCI is configured:
https://circleci.com/docs/2.0/workflows/#workflows-waiting-for-status-in-github
Marvin Froeder ***@***.***> wrote ..
… For some unknow reason, this is not building at all:
<img width="973" alt="Screen Shot 2021-06-16 at 15 22 56" src="https://user-images.githubusercontent.com/136590/122153278-28146f00-ce52-11eb-8ac2-492a74f39f88.png">
@kdavisk6 any clue?
--
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#1436 (comment)
|
…g back to legacy if all else fails. Interestingly, the methods I created for Android seem to work just fine in "vanilla" Java.
* Modify DefaultMethodHandler to work with Android. * Modified to work with Android. Previous commit worked up to API level 28 (Android 8) however, Android 9+ enforces more strict checking with reflection.
I was getting errors regarding illegal reflective access here, and also another one saying IMPL_LOOKUP was not defined, depending on the Android version I was running on.
These changes should work across the board, Android or actual JRE's.
A very frustrating way for someone inexperienced with reflection to spend a day :/
HTH someone!