Details
-
Task
-
Resolution: Unresolved
-
P2: Important
-
None
-
None
-
None
Description
While porting the QtPositioning android plugin to new public JNI API, I came up with some ideas for the improvement of the API.
- It might be useful to add QJniObject::call*Method overloads that use jmethodID instead of const char *methodName. Some client code (for example the QtPositioning plugin) already caches the method ids, but does not implement proper exception handling. Adding such overloads will reduce the overhead of querying the methods by name. Currently QJniObject implements a caching mechanism, but it uses locks, so using the saved jmethodIDs directly would still be more efficient.
- Same as above point but for fields.
- Almost the same idea for QJniEnvironment::registerNativeMethods. It uses const char *className, but can also use jclass parameter.
- It might make sense to extend the QJniEnvironment constructor with the version parameter. For now JNI_VERSION_1_6 is hardcoded, but what if a newer version is required? We can make JNI_VERSION_1_6 default, but give the user a possibility to override.
- Also probably makes sense to add some method to check that the constructed QJniEnvironment is valid. Looking into oracle jni docs makes me think, that we can simply check the native jniEnv pointer. But having a convenience method for that would be nice from our side, because the user would not need to dig into oracle docs.
Attachments
Issue Links
- relates to
-
QTBUG-96069 Qt 6.2.0 Beta3 runtime link error when run multimediawidgets sample on android arm
- Closed
-
QTBUG-54957 Implement QSslKey support of KeyChain private keys
- Reported
- resulted from
-
QTBUG-92475 Migrate QtPositioning android plugin to new public API
- Closed