Fixes an error where structs that contain optional bools where not properly converted from Java to C++.
interface SomeStruct {
someBool?: boolean
}
The reason this failed is because a Java boolean is not the same as a C++ boolean in JNI. It is an unsigned char, whereas a C++ boolean is a bool.
This cannot be implicitly converted, so we have to wrap booleans with static_cast<bool>(value) in order for it to work. This is what this PR now does.
And it adds the code to the example so it doesn't break in the future anymore.
Fixes an error where structs that contain optional bools where not properly converted from Java to C++.
The reason this failed is because a Java boolean is not the same as a C++ boolean in JNI. It is an
unsigned char
, whereas a C++ boolean is abool
. This cannot be implicitly converted, so we have to wrap booleans withstatic_cast<bool>(value)
in order for it to work. This is what this PR now does.And it adds the code to the example so it doesn't break in the future anymore.