JNI: Don't explicitly specify deducible template arguments

Minor cleanup that enables us to change the actual type in some of the
wrapper functions, so that we can implicitly convert a QString to a
jstring.

Change-Id: I2acc99c656231b302269fae439cf3dd49278f09a
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
This commit is contained in:
Volker Hilsheimer 2023-09-14 09:22:18 +02:00
parent d2f950e88f
commit 1d89f6602a

View File

@ -98,11 +98,7 @@ public:
auto callMethod(const char *methodName, Args &&...args) const
{
constexpr auto signature = QtJniTypes::methodSignature<Ret, Args...>();
if constexpr (std::is_same_v<Ret, void>) {
callMethod<void>(methodName, signature.data(), std::forward<Args>(args)...);
} else {
return callMethod<Ret>(methodName, signature.data(), std::forward<Args>(args)...);
}
return callMethod<Ret>(methodName, signature.data(), std::forward<Args>(args)...);
}
template <typename Ret, typename ...Args
@ -132,7 +128,7 @@ public:
{
QJniEnvironment env;
jmethodID id = getMethodID(env.jniEnv(), clazz, methodName, signature, true);
return callStaticMethod<Ret, Args...>(clazz, id, std::forward<Args>(args)...);
return callStaticMethod<Ret>(clazz, id, std::forward<Args>(args)...);
}
template <typename Ret, typename ...Args
@ -172,7 +168,7 @@ public:
{
QJniEnvironment env;
jclass clazz = QJniObject::loadClass(className, env.jniEnv());
return callStaticMethod<Ret, Args...>(clazz, methodName, std::forward<Args>(args)...);
return callStaticMethod<Ret>(clazz, methodName, std::forward<Args>(args)...);
}
template <typename Ret, typename ...Args