Avoid conversion in return from getHolder
Summary: Currently, we do a converting move from `local_ref<HybridDestructor::javaobject>` to `local_ref<HybridDestructor>`. Let's just return the right type directly, avoid the conversion, and save code size.
@@ -90,12 +90,12 @@ void setNativePointer(alias_ref<T> t, std::unique_ptr<detail::BaseHybridClass> n
// Inline rather than in cpp file so that consumers can call into
// their own copy directly rather than into the DSO containing fbjni,
// saving space for the symbol table.
-inline JField<PrimitiveOrJniType<HybridDestructor::javaobject>> getDestructorField(const local_ref<JClass>& c) {
+inline JField<HybridDestructor::javaobject> getDestructorField(const local_ref<JClass>& c) {
return c->template getField<HybridDestructor::javaobject>("mDestructor");
}
template<typename T>
-local_ref<HybridDestructor> getHolder(const T* t) {
+local_ref<HybridDestructor::javaobject> getHolder(const T* t) {
static auto holderField = getDestructorField(t->getClass());
return t->getFieldValue(holderField);
}
