diff options
| -rw-r--r-- | runtime/debugger.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/runtime/debugger.cc b/runtime/debugger.cc index 7117be9a54..e523fbb104 100644 --- a/runtime/debugger.cc +++ b/runtime/debugger.cc @@ -1231,7 +1231,15 @@ JDWP::JdwpError Dbg::CreateObject(JDWP::RefTypeId class_id, JDWP::ObjectId* new_ return error; } Thread* self = Thread::Current(); - mirror::Object* new_object = c->AllocObject(self); + mirror::Object* new_object; + if (c->IsStringClass()) { + // Special case for java.lang.String. + gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator(); + mirror::SetStringCountVisitor visitor(0); + new_object = mirror::String::Alloc<true>(self, 0, allocator_type, visitor); + } else { + new_object = c->AllocObject(self); + } if (new_object == nullptr) { DCHECK(self->IsExceptionPending()); self->ClearException(); |