From f50e29568066e293a54104086a11e72c3abb3823 Mon Sep 17 00:00:00 2001 From: Ivan Solovev Date: Fri, 21 Jul 2023 16:29:55 +0200 Subject: [PATCH] QJniObject: remove unused private methods These three private methods were introduced in 4e60681c879a54cf5b34862a30e27c492ed36363 together with the QJniObject class. Digging through the whole git log for the qjniobject.h header shows that the functions were never used. Not in template or inline methods, and not even in the out-of-line methods. Considering all the above, removing these methods would not cause BiC or SiC issues, so just do it. Pick-to: 6.6 Change-Id: Iaeeefbc2f1002e9413fd16651abd71381362a536 Reviewed-by: Marc Mutz Reviewed-by: Assam Boudjelthia --- src/corelib/kernel/qjniobject.cpp | 58 ------------------------------- src/corelib/kernel/qjniobject.h | 9 ----- 2 files changed, 67 deletions(-) diff --git a/src/corelib/kernel/qjniobject.cpp b/src/corelib/kernel/qjniobject.cpp index df4335092e4..07acd11db63 100644 --- a/src/corelib/kernel/qjniobject.cpp +++ b/src/corelib/kernel/qjniobject.cpp @@ -864,64 +864,6 @@ QByteArray QJniObject::className() const return d->m_className; } -QJniObject QJniObject::callObjectMethodV(const char *methodName, - const char *signature, - va_list args) const -{ - QJniEnvironment env; - jobject res = nullptr; - jmethodID id = getCachedMethodID(env.jniEnv(), methodName, signature); - if (id) { - res = env->CallObjectMethodV(d->m_jobject, id, args); - if (env.checkAndClearExceptions()) { - env->DeleteLocalRef(res); - res = nullptr; - } - } - - QJniObject obj(res); - env->DeleteLocalRef(res); - return obj; -} - -QJniObject QJniObject::callStaticObjectMethodV(const char *className, - const char *methodName, - const char *signature, - va_list args) -{ - QJniEnvironment env; - jobject res = nullptr; - jclass clazz = loadClass(className, env.jniEnv()); - if (clazz) { - jmethodID id = QJniObject::getCachedMethodID(env.jniEnv(), clazz, toBinaryEncClassName(className), - methodName, signature, true); - if (id) { - res = env->CallStaticObjectMethodV(clazz, id, args); - if (env.checkAndClearExceptions()) { - env->DeleteLocalRef(res); - res = nullptr; - } - } - } - - QJniObject obj(res); - env->DeleteLocalRef(res); - return obj; -} - -QJniObject QJniObject::callStaticObjectMethodV(jclass clazz, - const char *methodName, - const char *signature, - va_list args) -{ - QJniEnvironment env; - jmethodID id = getMethodID(env.jniEnv(), clazz, methodName, signature, true); - if (!id) - return QJniObject(); - - return getCleanJniObject(env->CallStaticObjectMethodV(clazz, id, args)); -} - /*! \fn template auto QJniObject::callMethod(const char *methodName, const char *signature, Args &&...args) const \since 6.4 diff --git a/src/corelib/kernel/qjniobject.h b/src/corelib/kernel/qjniobject.h index 2e1ed4add28..835052eb5bb 100644 --- a/src/corelib/kernel/qjniobject.h +++ b/src/corelib/kernel/qjniobject.h @@ -436,15 +436,6 @@ private: void callVoidMethodV(JNIEnv *env, jmethodID id, ...) const; // ### Qt 7: merge into ... overload void callVoidMethodV(JNIEnv *env, jmethodID id, va_list args) const; - // ### Qt 7: remove unused - QJniObject callObjectMethodV(const char *methodName, const char *signature, - va_list args) const; - // ### Qt 7: remove unused - static QJniObject callStaticObjectMethodV(const char *className, const char *methodName, - const char *signature, va_list args); - // ### Qt 7: remove unused - static QJniObject callStaticObjectMethodV(jclass clazz, const char *methodName, - const char *signature, va_list args); bool isSameObject(jobject obj) const; bool isSameObject(const QJniObject &other) const;