-
Notifications
You must be signed in to change notification settings - Fork 850
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
fix: bytecode version unspecified & NPE and trySetAccessible method does not exist on Android #1636
Conversation
Thanks -- I am going to open a PR soon that uses the "Errorprone" plugin to help detect these kinds of things proactively, but TBH nothing is going to be really permanently better until we have some way to do some sort of Android smoke test as part of the build, or somewhere in GitHub. Do you have any idea how other projects might handle this? In the meantime, I'd love to understand better why the change to the class file writing is necessary. I'd be even happier if we could find some way to write a test for it -- any ideas? |
Thank you for your feedback! Regarding testing: Reason for modifying ClassFileWriter.java: Changes made:
This approach aims to prevent NPE and maintain the engine's functionality in the Android environment. |
@@ -328,7 +328,8 @@ private void discoverAccessibleMethods( | |||
if (isPublic(mods) || isProtected(mods) || includePrivate) { | |||
MethodSignature sig = new MethodSignature(method); | |||
if (!map.containsKey(sig)) { | |||
if (includePrivate) method.trySetAccessible(); | |||
if (includePrivate && !method.isAccessible()) | |||
method.setAccessible(true); |
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 stumbled upon this place in #1575 (which probably will cause merge conflicts)
I'm wondering, if we should replace this with VMBridge.instance.tryToMakeAccessible(method)
which will effectively call this code: https://github.com/mozilla/rhino/blob/master/rhino/src/main/java/org/mozilla/javascript/jdk18/VMBridge_jdk18.java#L57
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.
Maybe that's a good idea. I guess it will work on Android too.
Thanks! Resolved the conflict and merged manually. |
Fixes #1634