diff options
author | Assam Boudjelthia <assam.boudjelthia@qt.io> | 2021-04-13 11:54:33 +0300 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-04-14 17:56:48 +0000 |
commit | 3f7e3983d53c01f057af0335cf9db4e736f1552a (patch) | |
tree | 12002366f9a4bafee1020da8d89aedac586ab1a9 /tests | |
parent | af27a5029ef3b54a1f6a62edf9fa30b07fadfff9 (diff) |
Replace conversion operator by operator* in QJniEnvironment
Since conversion operators do implicit conversion that might bring
some potential issues while using the API, let's stick to having
an operator* instead.
Change-Id: Ie7ad5537958944b8d1c11d69fbd30284b4b0344d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit 13592385723a9b81b3715b5344bdd04e6a393a12)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/kernel/qjnienvironment/tst_qjnienvironment.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/auto/corelib/kernel/qjnienvironment/tst_qjnienvironment.cpp b/tests/auto/corelib/kernel/qjnienvironment/tst_qjnienvironment.cpp index 2cd0b7ea76..278554e496 100644 --- a/tests/auto/corelib/kernel/qjnienvironment/tst_qjnienvironment.cpp +++ b/tests/auto/corelib/kernel/qjnienvironment/tst_qjnienvironment.cpp @@ -26,6 +26,8 @@ ** ****************************************************************************/ +#include <jni.h> + #include <QtCore/QJniEnvironment> #include <QtCore/QJniObject> #include <QtTest/QtTest> @@ -56,7 +58,7 @@ void tst_QJniEnvironment::jniEnv() JNIEnv *jni = 0; QCOMPARE(javaVM->GetEnv((void**)&jni, JNI_VERSION_1_6), JNI_OK); - JNIEnv *e = env; + JNIEnv *e = env.jniEnv(); QVERIFY(e); QCOMPARE(env->GetVersion(), JNI_VERSION_1_6); @@ -71,11 +73,11 @@ void tst_QJniEnvironment::jniEnv() env->ExceptionClear(); QVERIFY(env->FindClass("java/lang/Object")); - QVERIFY(!QJniEnvironment::checkAndClearExceptions(env)); + QVERIFY(!QJniEnvironment::checkAndClearExceptions(env.jniEnv())); // try to find a nonexistent class QVERIFY(!env->FindClass("this/doesnt/Exist")); - QVERIFY(QJniEnvironment::checkAndClearExceptions(env)); + QVERIFY(QJniEnvironment::checkAndClearExceptions(env.jniEnv())); // try to find an existing class with QJniEnvironment QJniEnvironment env; @@ -110,6 +112,7 @@ void tst_QJniEnvironment::javaVM() static void callbackFromJava(JNIEnv *env, jobject /*thiz*/, jstring value) { + Q_UNUSED(env) registerNativesString = QJniObject(value).toString(); } |