JNI: Fix static_assert for type registrations
Types signatures have to start with either "[L" (array of class) or "L" (just class), and end with ";". Only "[" (array of primitive type) makes no sense, esp since we also require a terminating ";". Change-Id: Iea9ce992c31a34639016c967f813ebf9343c6978 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
parent
102670a82e
commit
d41ae1a9a8
@ -27,12 +27,12 @@ template<> \
|
|||||||
struct QtJniTypes::Traits<QtJniTypes::Type> { \
|
struct QtJniTypes::Traits<QtJniTypes::Type> { \
|
||||||
static constexpr auto signature() \
|
static constexpr auto signature() \
|
||||||
{ \
|
{ \
|
||||||
static_assert((Signature[0] == 'L' \
|
constexpr QtJniTypes::CTString sig(Signature); \
|
||||||
|| Signature[0] == '[') \
|
static_assert((sig.startsWith('L') || sig.startsWith("[L")) \
|
||||||
&& Signature[sizeof(Signature) - 2] == ';', \
|
&& sig.endsWith(';'), \
|
||||||
"Type signature needs to start with 'L' or" \
|
"Type signature needs to start with 'L' or" \
|
||||||
" '[' and end with ';'"); \
|
" '[L', and end with ';'"); \
|
||||||
return QtJniTypes::CTString(Signature); \
|
return sig; \
|
||||||
} \
|
} \
|
||||||
}; \
|
}; \
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user