diff --git a/java/jni/YGJNIVanilla.cpp b/java/jni/YGJNIVanilla.cpp index 31ad05aa..555a13c7 100644 --- a/java/jni/YGJNIVanilla.cpp +++ b/java/jni/YGJNIVanilla.cpp @@ -21,8 +21,7 @@ using facebook::yoga::detail::Log; static inline ScopedLocalRef YGNodeJobject( YGNodeRef node, void* layoutContext) { - return reinterpret_cast(layoutContext) - ->ref(getCurrentEnv(), node); + return reinterpret_cast(layoutContext)->ref(node); } static inline YGNodeRef _jlong2YGNodeRef(jlong addr) { diff --git a/java/jni/YGJTypesVanilla.h b/java/jni/YGJTypesVanilla.h index 33d9c060..9de9a56c 100644 --- a/java/jni/YGJTypesVanilla.h +++ b/java/jni/YGJTypesVanilla.h @@ -29,7 +29,8 @@ public: } } - ScopedLocalRef ref(JNIEnv* env, YGNodeRef node) { + ScopedLocalRef ref(YGNodeRef node) { + JNIEnv* env = getCurrentEnv(); auto idx = ptrsToIdxs_.find(node); if (idx == ptrsToIdxs_.end()) { return ScopedLocalRef(env);