-
Notifications
You must be signed in to change notification settings - Fork 23
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
Refactor Android init methods for more flexibility #159
base: main
Are you sure you want to change the base?
Conversation
5ce176b
to
06a3b12
Compare
IMO it would be nice to split this into three commits, one for each rename and one for the new API. I'm not entirely sure whether it's worth it to force downstream users to go through a deprecation at this point for the cosmetic benefit of a better name -- maybe start with a soft deprecation as part of a comment? |
@djc good call, I like that plan better too. It also makes me think I can do a better job at documenting the differences in the rustdocs, so I'll take care of that and report back when they're broken into independent commits. |
this is a soft deprecation, only noted as a rustdoc.
this is a soft deprecation, only noted as a rustdoc.
06a3b12
to
cab55fe
Compare
Alright, done! How does this rendition look? |
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 much better!
My review is by no means sufficient for this code, but this looks okay to me.
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.
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.
Just a few small nits to note. Nice tidy :-)
Pushed a commit with all the fixes for the typos mentioned in the review and while going through it one more time, realized that the warning block had some unnecessary commas and wasn't rendering markdown backticks as expected, so I just removed them. |
After integrating
rustls-platform-verifier
into a codebase that uses Android, I wrote this PR to propose a more flexible initialization API. Specifically, it would be nice to, rather than passing in a contextJObject
that isn'tCopy
/Clone
, to instead allow people to pass in aGlobalRef
directly, which is what already happens behind the scenes ininit_hosted
.I also modified the names of the existing methods as well to try to be more clear about what each of the 3 init options offer. I also kept the old names and marked them as deprecated to allow for backwards-compatibility.
fn init_hosted(env: &mut JNIEnv, context: JObject) -> Result<(), JNIError>
fn init_with_env(env: &mut JNIEnv, context: JObject) -> Result<(), JNIError>
fn init_external(runtime: &'static dyn Runtime)
fn init_with_runtime(runtime: &'static dyn Runtime)
fn init_with_refs(java_vm: JavaVM, context: GlobalRef, loader: GlobalRef)