summaryrefslogtreecommitdiff
path: root/runtime/mirror/object.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/mirror/object.cc')
-rw-r--r--runtime/mirror/object.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/runtime/mirror/object.cc b/runtime/mirror/object.cc
index 7e92c53a09..8cfb60e60e 100644
--- a/runtime/mirror/object.cc
+++ b/runtime/mirror/object.cc
@@ -266,7 +266,7 @@ void Object::CheckFieldAssignmentImpl(MemberOffset field_offset, ObjPtr<Object>
}
}
LOG(FATAL) << "Failed to find field for assignment to " << reinterpret_cast<void*>(this)
- << " of type " << PrettyDescriptor(c) << " at offset " << field_offset;
+ << " of type " << c->PrettyDescriptor() << " at offset " << field_offset;
UNREACHABLE();
}
@@ -275,5 +275,24 @@ ArtField* Object::FindFieldByOffset(MemberOffset offset) {
: ArtField::FindInstanceFieldWithOffset(GetClass(), offset.Uint32Value());
}
+std::string Object::PrettyTypeOf(ObjPtr<mirror::Object> obj) {
+ if (obj == nullptr) {
+ return "null";
+ }
+ return obj->PrettyTypeOf();
+}
+
+std::string Object::PrettyTypeOf() {
+ if (GetClass() == nullptr) {
+ return "(raw)";
+ }
+ std::string temp;
+ std::string result(PrettyDescriptor(GetClass()->GetDescriptor(&temp)));
+ if (IsClass()) {
+ result += "<" + PrettyDescriptor(AsClass()->GetDescriptor(&temp)) + ">";
+ }
+ return result;
+}
+
} // namespace mirror
} // namespace art