You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should refactor the JNI code in api/src/lib to make it cleaner:
Remove all code duplications (e.g. when creating a jobjects to return, when evaluating a Result and return j_object::null if it is an Err variant, and so on);
Remove all unnecessary input parameters (like the JClass when they are not needed);
Remove unnecessary copies and write-to-fixed-size-buffer operations;
Use a logger (we could initialize it using the same JNI_onLoad() function) and log all the operations (be sure that doesn't conflict with the one employed by the SidechainsSDK)
Uniform the logic to perform certain operations (e.g. the "free" functions are sometimes implemented by taking as argument the pointer to free, other times by directly working with the JObject containing the pointer);
Refactor the code in api/ginger_calls.rs and api/lib.rs by splitting it in submodules;
The text was updated successfully, but these errors were encountered:
DanieleDiBenedetto
changed the title
Clean up and uniform JNI code
Clean up, optimize and uniform JNI code
Aug 6, 2020
Java classes and methods can be cached at startup (e.g. by implementing JNI_onLoad() function and putting the code inside it), so that it won't be necessary to perform a lookup each time they are needed (like in https://github.com/exonum/exonum-java-binding/tree/master/exonum-java-binding/core/rust);
I benched it locally and it seems to not lead to any significant benefit, so let's give to this point a low priority.
We should refactor the JNI code in api/src/lib to make it cleaner:
The text was updated successfully, but these errors were encountered: