Implement ArrayType.NewInstance.
First fruit of getting the JDWP test suite running... though it turned out
there was an old check-in comment explaining how to exercise this. I've
added that comment to the source here.
Change-Id: Iaf8beb64763773f9c756ae9a6cf6e652f4a0afba
diff --git a/src/debugger.cc b/src/debugger.cc
index f31ae58..b2ea527 100644
--- a/src/debugger.cc
+++ b/src/debugger.cc
@@ -709,9 +709,13 @@
return gRegistry->Add(c->AllocObject());
}
+/*
+ * Used by Eclipse's "Display" view to evaluate "new byte[5]" to get "(byte[]) [0, 0, 0, 0, 0]".
+ */
JDWP::ObjectId Dbg::CreateArrayObject(JDWP::RefTypeId arrayTypeId, uint32_t length) {
- UNIMPLEMENTED(FATAL);
- return 0;
+ Class* array_class = gRegistry->Get<Class*>(arrayTypeId);
+ CHECK(array_class->IsArrayClass()) << PrettyClass(array_class);
+ return gRegistry->Add(Array::Alloc(array_class, length));
}
bool Dbg::MatchType(JDWP::RefTypeId instClassId, JDWP::RefTypeId classId) {