Don't wrap the actual type in parens if its null.
Otherwise the exception message has unnecessary parens:
"expected receiver of type java.lang.String, but got (null)"
Change-Id: Iacd806d018019784afa6e9f25f7c039d9ca18fae
diff --git a/vm/Misc.cpp b/vm/Misc.cpp
index 059e6bb..1365516 100644
--- a/vm/Misc.cpp
+++ b/vm/Misc.cpp
@@ -269,7 +269,7 @@
std::string dvmHumanReadableType(const Object* obj)
{
if (obj == NULL) {
- return "(null)";
+ return "null";
}
if (obj->clazz == NULL) {
/* should only be possible right after a plain dvmMalloc() */
diff --git a/vm/interp/Stack.cpp b/vm/interp/Stack.cpp
index 7b12e7b..ad6af82 100644
--- a/vm/interp/Stack.cpp
+++ b/vm/interp/Stack.cpp
@@ -635,12 +635,7 @@
static void throwArgumentTypeMismatch(int argIndex, ClassObject* expected, DataObject* arg) {
std::string expectedClassName(dvmHumanReadableDescriptor(expected->descriptor));
- std::string actualClassName;
- if (arg != NULL) {
- actualClassName = dvmHumanReadableType(arg);
- } else {
- actualClassName = "null";
- }
+ std::string actualClassName = dvmHumanReadableType(arg);
dvmThrowExceptionFmt(gDvm.exIllegalArgumentException, "argument %d should have type %s, got %s",
argIndex + 1, expectedClassName.c_str(), actualClassName.c_str());
}