Fix the invocation interface.
Previously, we just cast the Runtime* to a JavaVM*, which blew up as soon as
the caller tried to use their supposed JavaVM*.
This also implements NewObjectArray. Running aexecd on the host, this gets us
as far as not having an x86 CreateInvokeStub...
Change-Id: Iba5f148797d053fba1c69af99b20508ea6aff5cb
diff --git a/src/jni_internal_test.cc b/src/jni_internal_test.cc
index ce640e2..df9844f 100644
--- a/src/jni_internal_test.cc
+++ b/src/jni_internal_test.cc
@@ -60,6 +60,10 @@
TEST_F(JniInternalTest, NewPrimitiveArray) {
// TODO: death tests for negative array sizes.
+ // TODO: check returned array size.
+
+ // TODO: check returned array class.
+
CHECK(env_->NewBooleanArray(0) != NULL);
CHECK(env_->NewByteArray(0) != NULL);
CHECK(env_->NewCharArray(0) != NULL);
@@ -79,6 +83,22 @@
CHECK(env_->NewShortArray(1) != NULL);
}
+TEST_F(JniInternalTest, NewObjectArray) {
+ // TODO: death tests for negative array sizes.
+
+ // TODO: check returned array size.
+
+ // TODO: check returned array class.
+
+ // TODO: check non-NULL initial elements.
+
+ jclass c = env_->FindClass("[Ljava.lang.String;");
+
+ CHECK(env_->NewObjectArray(0, c, NULL) != NULL);
+
+ CHECK(env_->NewObjectArray(1, c, NULL) != NULL);
+}
+
bool EnsureInvokeStub(Method* method);
byte* AllocateCode(void* code, size_t length) {