Various bits of cleanup.
Most notable: PrettyField now includes the type (but, like PrettyMethod,
lets you turn this off), and there's a new PrettyClass, and PrettyType
has been renamed to PrettyTypeOf.
I've also moved the dalvik "sync" stuff into files named "monitor", and
made some of the implementation details private.
Change-Id: I39ea79b45e173f9ebbf9878bcead207766a5653f
diff --git a/src/utils_test.cc b/src/utils_test.cc
index 21167d6..0869b89 100644
--- a/src/utils_test.cc
+++ b/src/utils_test.cc
@@ -56,20 +56,44 @@
EXPECT_DESCRIPTOR("short", "S");
}
-TEST_F(UtilsTest, PrettyType) {
- EXPECT_EQ("null", PrettyType(NULL));
+TEST_F(UtilsTest, PrettyTypeOf) {
+ EXPECT_EQ("null", PrettyTypeOf(NULL));
String* s = String::AllocFromModifiedUtf8("");
- EXPECT_EQ("java.lang.String", PrettyType(s));
+ EXPECT_EQ("java.lang.String", PrettyTypeOf(s));
ShortArray* a = ShortArray::Alloc(2);
- EXPECT_EQ("short[]", PrettyType(a));
+ EXPECT_EQ("short[]", PrettyTypeOf(a));
Class* c = class_linker_->FindSystemClass("[Ljava/lang/String;");
ASSERT_TRUE(c != NULL);
Object* o = ObjectArray<String>::Alloc(c, 0);
- EXPECT_EQ("java.lang.String[]", PrettyType(o));
- EXPECT_EQ("java.lang.Class<java.lang.String[]>", PrettyType(o->GetClass()));
+ EXPECT_EQ("java.lang.String[]", PrettyTypeOf(o));
+ EXPECT_EQ("java.lang.Class<java.lang.String[]>", PrettyTypeOf(o->GetClass()));
+}
+
+TEST_F(UtilsTest, PrettyClass) {
+ EXPECT_EQ("null", PrettyClass(NULL));
+ Class* c = class_linker_->FindSystemClass("[Ljava/lang/String;");
+ ASSERT_TRUE(c != NULL);
+ Object* o = ObjectArray<String>::Alloc(c, 0);
+ EXPECT_EQ("java.lang.Class<java.lang.String[]>", PrettyClass(o->GetClass()));
+}
+
+TEST_F(UtilsTest, PrettyField) {
+ EXPECT_EQ("null", PrettyField(NULL));
+
+ Class* java_lang_String = class_linker_->FindSystemClass("Ljava/lang/String;");
+ Class* int_class = class_linker_->FindPrimitiveClass('I');
+ Class* char_array_class = class_linker_->FindSystemClass("[C");
+
+ Field* f;
+ f = java_lang_String->FindDeclaredInstanceField("count", int_class);
+ EXPECT_EQ("int java.lang.String.count", PrettyField(f));
+ EXPECT_EQ("java.lang.String.count", PrettyField(f, false));
+ f = java_lang_String->FindDeclaredInstanceField("value", char_array_class);
+ EXPECT_EQ("char[] java.lang.String.value", PrettyField(f));
+ EXPECT_EQ("java.lang.String.value", PrettyField(f, false));
}
TEST_F(UtilsTest, MangleForJni) {