From 1de914737a3c8f87d36741009ba5ff9e04641e26 Mon Sep 17 00:00:00 2001 From: Emil Sjolander Date: Wed, 12 Oct 2016 03:44:52 -0700 Subject: [PATCH] Automatically init native memory when allocating java wrapper Summary: Don't require calling init() to used an allocated object. This makes more sense and is more in line with how jni in java is generally managed. Reviewed By: lucasr Differential Revision: D3992802 fbshipit-source-id: 06d65821f1802ed8f2b2db651cef69f6851803f2 --- java/com/facebook/csslayout/CSSNode.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/java/com/facebook/csslayout/CSSNode.java b/java/com/facebook/csslayout/CSSNode.java index 497e175d..1fb31ec4 100644 --- a/java/com/facebook/csslayout/CSSNode.java +++ b/java/com/facebook/csslayout/CSSNode.java @@ -35,6 +35,10 @@ public class CSSNode implements CSSNodeAPI { private long mNativePointer; private Object mData; + public CSSNode() { + init(); + } + private void assertNativeInstance() { if (mNativePointer == 0) { throw new IllegalStateException("Null native pointer");