Commit 654a8a37 authored by Jernej Virag's avatar Jernej Virag

Fix set cpp -> java marshaling

parent 163fbe4d
...@@ -411,13 +411,14 @@ namespace djinni ...@@ -411,13 +411,14 @@ namespace djinni
static LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c) static LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c)
{ {
assert(c.size() <= std::numeric_limits<jint>::max());
const auto& data = JniClass<SetJniInfo>::get(); const auto& data = JniClass<SetJniInfo>::get();
auto j = LocalRef<jobject>(jniEnv, jniEnv->NewObject(data.clazz.get(), data.constructor)); assert(c.size() <= std::numeric_limits<jint>::max());
auto size = static_cast<jint>(c.size());
auto j = LocalRef<jobject>(jniEnv, jniEnv->NewObject(data.clazz.get(), data.constructor, size));
jniExceptionCheck(jniEnv); jniExceptionCheck(jniEnv);
for(const auto& ce : c) for(const auto& ce : c)
{ {
auto je = T::fromCpp(jniEnv, ce); auto je = T::Boxed::fromCpp(jniEnv, ce);
jniEnv->CallBooleanMethod(j, data.method_add, get(je)); jniEnv->CallBooleanMethod(j, data.method_add, get(je));
jniExceptionCheck(jniEnv); jniExceptionCheck(jniEnv);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment