summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qjnienvironment.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Android: check if objectClass() is not null in registerNativeMethods()Assam Boudjelthia2021-11-151-3/+4
| | | | | | | | | | | | In case the class doens't have a default constructor, checking for object.isValid() will give false because the object won't be created, however, the class could still be loaded and we could have a valid jclass. Pick-to: 6.2 Fixes: QTBUG-96069 Change-Id: I8d59e26d9d7c0e8e363ce443937091a374a24473 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Doc: Ensure deprecated APIs in Qt Core are documented as suchNico Vertriest2021-07-231-5/+2
| | | | | | | | | | Added \deprecated [version_since] when needed Remove references to deprecated functions in \sa statements Fixes: QTBUG-94534 Pick-to: 6.2 Change-Id: I3b3d4277d63fc5d6d207c28ff2484aed30b83247 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* JNI: check if clazz is null before doing a jni callAssam Boudjelthia2021-06-101-8/+16
| | | | | | | | | | Also add missing \since keyword. Task-number: QTBUG-92952 Pick-to: 6.2 Change-Id: Ia1472f04955809fb5132a4b6239dbcbdf63cca93 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* JNI: state that findClass() returns a global refAssam Boudjelthia2021-06-101-11/+13
| | | | | | | | | Fix docs to state that findClass() returns a global ref from the cached classes list. Pick-to: 6.2 Change-Id: I7c45cc4c9e1c6e109db7cf7d926a250592798972 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* JNI: Add calls to get field IDsAssam Boudjelthia2021-06-041-0/+45
| | | | | | | Task-number: QTBUG-92952 Change-Id: Ie68ede4b00a411064a29925b28b1f60a84d2d678 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Add a const JNINativeMethod[] overload for registerNativeMethods()Assam Boudjelthia2021-06-021-5/+39
| | | | | | | | | | | The JNI interface expects a const JNINativeMethod[] and our wrapper takes a non-const. Also, this was causing refactoring of exisisting code with a const JNINativeMethod[] to fail because the call expects a non-const. Change-Id: If790c401650cb33fe31f93bafe41aab7714488e9 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add isValid() call to QJniEnvironmentAssam Boudjelthia2021-05-171-0/+10
| | | | | | Task-number: QTBUG-92952 Change-Id: I3bce2881c10a8bfcc8771002a3349644c6f05cb3 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Add objectClass() and className() for QJniObjectAssam Boudjelthia2021-05-081-6/+1
| | | | | | | | This can be handy sometimes to avoid doing a env->GetObjectClass() call to get the jclass object. Change-Id: I015fe5ed73304338826e468e59778bcd3ceadc3b Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Doc: Fix documentation warnings for QJni* classesTopi Reinio2021-05-051-1/+1
| | | | | | Pick-to: 6.1 Change-Id: Iab836fbdf649f1b3b60e88d32266361299ac4bb2 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QJniEnvironment: extend APIIvan Solovev2021-05-031-5/+70
| | | | | | | | | | | | | | This patch adds some convenience methods to QJniEnvironment API: * an overload of registerNativeMethods() that accepts jclass instead of const char *className. * a findMethod() function is added to query a methodID of a static or nonstatic method by its name and signature. Task-number: QTBUG-92952 Change-Id: Ib1bc892decea97e625c4822888b6183af6edd6dc Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Add documentation links for some JNI entitiesAssam Boudjelthia2021-04-161-2/+4
| | | | | | | | | | Add doc page link for: * AttachCurrentThread call. * Interface Function Table which describes JNIEnv. Pick-to: 6.1 6.1.0 Change-Id: I12b41429c40838e5133e58132930aede287e2e71 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Replace conversion operator by operator* in QJniEnvironmentAssam Boudjelthia2021-04-141-6/+16
| | | | | | | | | | | Since conversion operators do implicit conversion that might bring some potential issues while using the API, let's stick to having an operator* instead. Pick-to: 6.1 6.1.0 Change-Id: Ie7ad5537958944b8d1c11d69fbd30284b4b0344d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Rename QJniEnvironment exceptionCheckAndClear to checkAndClearExceptionsAssam Boudjelthia2021-03-261-7/+7
| | | | | | | | | Address feedback from header view. Task-number: QTBUG-90211 Pick-to: 6.1 Change-Id: Iad2b609598b16f66fd6ab09484fe6e6899981263 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix some qdoc-warnings for 6.1Friedemann Kleint2021-02-181-0/+4
| | | | | | | | | | | | | | | | | Fix: qtbase/src/testlib/qtestelementattribute.cpp:89: (qdoc) warning: Undocumented enum item 'LET_Message' in QTest::LogElementType qtbase/src/testlib/qtestelementattribute.cpp:89: (qdoc) warning: No such enum item 'LET_Error' in QTest::LogElementType qtbase/src/testlib/qtestelementattribute.cpp:89: (qdoc) warning: Undocumented enum item 'LET_SystemOutput' in QTest::LogElementType qtbase/src/network/ssl/qsslsocket.cpp:1666: (qdoc) warning: Unknown command '\cl' qtbase/src/corelib/kernel/qproperty.cpp:883: (qdoc) warning: Unknown command '\T' qtbase/src/corelib/kernel/qproperty.cpp:799: (qdoc) warning: Undocumented return value (hint: use 'return' or 'returns' in the text qtbase/src/corelib/kernel/qjnienvironment.cpp:250: (qdoc) warning: Undocumented return value (hint: use 'return' or 'returns' in the text Pick-to: 6.1 Change-Id: I116f5d8ace2c29ba7b6b93256d5761591e01296a Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
* Fix registerNativeMethods for goodAssam Boudjelthia2021-02-111-3/+4
| | | | | | | | | | | | | | | | | The initial implementation and the commit c00ab6f8eaa3cdc9a29dd103c91b2eaf212cac9f was wrong: * env->findClass() in fact returns a global reference, and in any case we shouldn't be calling that, instead QJniObject would be enough. * The size param provided to env->RegisterNatives was wrong. * A test for registerNativeMethods() is added to ensure such break is not repeated again. Task-number: QTBUG-89633 Pick-to: 6.1 Change-Id: I4d3a6a9270755f465c40add25521fb750dd4de0a Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Documentation improvements to JNI APIAssam Boudjelthia2021-02-091-26/+42
| | | | | | | | | | | Amends 4e60681c879a54cf5b34862a30e27c492ed36363. Fixes: QTBUG-89632 Pick-to: 6.1 Change-Id: I7856e9b63eea5ba68a5472575016540ae656ec5f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix QJniObject::registerNativeMethods use of global referenceAssam Boudjelthia2021-02-021-4/+3
| | | | | | | | | registerNativeMethods() should be using the local jclass from findClass() instead of the global reference. Task-number: QTBUG-89633 Change-Id: I469a9a1ecff95ab9948421baa5c88735ba7ad776 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Make QJniObject and QJniEnvironment public APIAssam Boudjelthia2021-01-271-0/+283
As part of Qt 6 restructring for the extras modules, this change exposes the Jni APIs which are very important for Android platform. This patch adds the APIs QJniObject, QJniEnvironment, QJniExceptionCleaner based from private QtCore and QtAndroidExtras. The Jni interface is cross-platform which justifies the name, but currently, this API is used mainly for Android, and the naming comes generic without Android keyword to avoid any future limitation on supporting other platforms. [ChangeLog][QtCore] Add new QJniObject, QJniEnvironment and QJniExceptionCleaner APIs. Task-number: QTBUG-89482 Fixes: QTBUG-89633 Change-Id: I4382dd53a225375759b9d042f6035a4a9810572b Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>