JNI: fix isObjectType trait function

Java arrays are always objects, also if they don't contain objects.

Pick-to: 6.6
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>
This commit is contained in:
Volker Hilsheimer 2023-09-14 19:11:48 +02:00
parent 1de8cb8f91
commit d2f950e88f

View File

@ -243,6 +243,13 @@ static constexpr bool isPrimitiveType()
return typeSignature<T>().size() == 2;
}
template<typename T>
static constexpr bool isArrayType()
{
constexpr auto signature = typeSignature<T>();
return signature.startsWith('[') && signature.size() > 2;
}
template<typename T>
static constexpr bool isObjectType()
{
@ -250,18 +257,10 @@ static constexpr bool isObjectType()
return true;
} else {
constexpr auto signature = typeSignature<T>();
return (signature.startsWith('L') || signature.startsWith('['))
&& signature.endsWith(';');
return (signature.startsWith('L') && signature.endsWith(';')) || isArrayType<T>();
}
}
template<typename T>
static constexpr bool isArrayType()
{
constexpr auto signature = typeSignature<T>();
return signature.startsWith('[');
}
template<typename T>
static constexpr void assertObjectType()
{