JNI: Mark tech preview API as such

Retrofit the QT_TECH_PREVIEW_API macro into the JNI classes and
helper constructs that are not yet documented, and which can only
become publicly documented once the full JNI type system with the
type registration infrastructure is documented.

We can remove the tagging in dev once we have documentation and
are ready to move this functionality out of TP, presumably for Qt 6.8.

Change-Id: I235e57b8e57c2d04be72b4c842131d99a5f83d9e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 5b41046813d21d565904a6b37bef4b75268fc8f5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Volker Hilsheimer 2024-05-06 13:13:02 +02:00 committed by Qt Cherry-pick Bot
parent e259e5b9c5
commit e8b3e37c5a
4 changed files with 13 additions and 7 deletions

View File

@ -17,7 +17,7 @@ QT_BEGIN_NAMESPACE
template <typename T> class QJniArray;
template <typename T>
struct QJniArrayIterator
struct QT_TECH_PREVIEW_API QJniArrayIterator
{
QJniArrayIterator() = default;
@ -85,7 +85,7 @@ private:
{}
};
class QJniArrayBase
class QT_TECH_PREVIEW_API QJniArrayBase
{
// for SFINAE'ing out the fromContainer named constructor
template <typename Container, typename = void> struct CanConvertHelper : std::false_type {};
@ -190,7 +190,7 @@ private:
};
template <typename T>
class QJniArray : public QJniArrayBase
class QT_TECH_PREVIEW_API QJniArray : public QJniArrayBase
{
friend struct QJniArrayIterator<T>;
public:

View File

@ -69,6 +69,7 @@ public:
, std::enable_if_t<QtJniTypes::isObjectType<Class>(), bool> = true
#endif
>
QT_TECH_PREVIEW_API
bool registerNativeMethods(std::initializer_list<JNINativeMethod> methods)
{
return registerNativeMethods(QtJniTypes::Traits<Class>::className().data(), methods);

View File

@ -668,7 +668,7 @@ inline bool operator!=(const QJniObject &obj1, const QJniObject &obj2)
}
namespace QtJniTypes {
struct JObjectBase
struct QT_TECH_PREVIEW_API JObjectBase
{
operator QJniObject() const { return m_object; }
@ -693,7 +693,7 @@ protected:
};
template<typename Type>
class JObject : public JObjectBase
class QT_TECH_PREVIEW_API JObject : public JObjectBase
{
public:
using Class = Type;

View File

@ -11,6 +11,7 @@
QT_BEGIN_NAMESPACE
// QT_TECH_PREVIEW_API
#define Q_DECLARE_JNI_TYPE_HELPER(Type) \
namespace QtJniTypes { \
struct Type : JObject<Type> \
@ -19,7 +20,7 @@ struct Type : JObject<Type> \
}; \
} \
// QT_TECH_PREVIEW_API
#define Q_DECLARE_JNI_TYPE(Type, Signature) \
Q_DECLARE_JNI_TYPE_HELPER(Type) \
template<> \
@ -35,6 +36,7 @@ struct QtJniTypes::Traits<QtJniTypes::Type> { \
} \
}; \
// QT_TECH_PREVIEW_API
#define Q_DECLARE_JNI_CLASS(Type, Signature) \
Q_DECLARE_JNI_TYPE_HELPER(Type) \
template<> \
@ -149,7 +151,7 @@ va_##Method(JNIEnv *env, jclass thiz, ...)
}, argTuple); \
} \
// QT_TECH_PREVIEW_API
#define Q_DECLARE_JNI_NATIVE_METHOD(...) \
QT_OVERLOADED_MACRO(QT_DECLARE_JNI_NATIVE_METHOD, __VA_ARGS__) \
@ -167,8 +169,10 @@ static const JNINativeMethod Method##_method = { \
#define QT_DECLARE_JNI_NATIVE_METHOD_1(Method) \
QT_DECLARE_JNI_NATIVE_METHOD_2(Method, Method) \
// QT_TECH_PREVIEW_API
#define Q_JNI_NATIVE_METHOD(Method) QtJniMethods::Method##_method
// QT_TECH_PREVIEW_API
#define Q_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE(...) \
QT_OVERLOADED_MACRO(QT_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE, __VA_ARGS__) \
@ -182,6 +186,7 @@ static const JNINativeMethod Method##_method = { \
#define QT_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE_1(Method) \
QT_DECLARE_JNI_NATIVE_METHOD_IN_CURRENT_SCOPE_2(Method, Method) \
// QT_TECH_PREVIEW_API
#define Q_JNI_NATIVE_SCOPED_METHOD(Method, Scope) Scope::Method##_method
QT_END_NAMESPACE