JNI: fix isObjectType trait function
Java arrays are always objects, also if they don't contain objects. Change-Id: I376c9cc39445d7d9aaac093e4cd6995c8322ed0d Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io> Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io> Reviewed-by: Zoltan Gera <zoltan.gera@qt.io> (cherry picked from commit d2f950e88f6f3966e5593e06f307959d12c19ec8) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
224d4ad279
commit
345d3efe3f
@ -241,23 +241,22 @@ static constexpr bool isPrimitiveType()
|
|||||||
return typeSignature<T>().size() == 2;
|
return typeSignature<T>().size() == 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
static constexpr bool isObjectType()
|
|
||||||
{
|
|
||||||
if constexpr(std::is_convertible<T, jobject>::value) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
constexpr auto signature = typeSignature<T>();
|
|
||||||
return (signature.startsWith('L') || signature.startsWith('['))
|
|
||||||
&& signature.endsWith(';');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static constexpr bool isArrayType()
|
static constexpr bool isArrayType()
|
||||||
{
|
{
|
||||||
constexpr auto signature = typeSignature<T>();
|
constexpr auto signature = typeSignature<T>();
|
||||||
return signature.startsWith('[');
|
return signature.startsWith('[') && signature.size() > 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
static constexpr bool isObjectType()
|
||||||
|
{
|
||||||
|
if constexpr (std::is_convertible_v<T, jobject>) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
constexpr auto signature = typeSignature<T>();
|
||||||
|
return (signature.startsWith('L') && signature.endsWith(';')) || isArrayType<T>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user