Remove mirror:: and ArtMethod deps in utils.{h,cc}
The latest chapter in the ongoing saga of attempting to dump a DEX
file without having to start a whole runtime instance. This episode
finds us removing references to ArtMethod/ArtField/mirror.
One aspect of this change that I would like to call out specfically
is that the utils versions of the "Pretty*" functions all were written
to accept nullptr as an argument. I have split these functions up as
follows:
1) an instance method, such as PrettyClass that obviously requires
this != nullptr.
2) a static method, that behaves the same way as the util method, but
calls the instance method if p != nullptr.
This requires using a full class qualifier for the static methods,
which isn't exactly beautiful. I have tried to remove as many cases
as possible where it was clear p != nullptr.
Bug: 22322814
Test: test-art-host
Change-Id: I21adee3614aa697aa580cd1b86b72d9206e1cb24
diff --git a/runtime/class_linker_test.cc b/runtime/class_linker_test.cc
index 4fac830..ab18627 100644
--- a/runtime/class_linker_test.cc
+++ b/runtime/class_linker_test.cc
@@ -332,9 +332,9 @@
EXPECT_FALSE(method.IsDirect());
EXPECT_TRUE(method.IsCopied());
EXPECT_TRUE(method.GetDeclaringClass()->IsInterface())
- << "declaring class: " << PrettyClass(method.GetDeclaringClass());
+ << "declaring class: " << method.GetDeclaringClass()->PrettyClass();
EXPECT_TRUE(method.GetDeclaringClass()->IsAssignableFrom(klass.Get()))
- << "declaring class: " << PrettyClass(method.GetDeclaringClass());
+ << "declaring class: " << method.GetDeclaringClass()->PrettyClass();
}
for (size_t i = 0; i < klass->NumInstanceFields(); i++) {
@@ -366,8 +366,7 @@
if (current_ref_offset.Uint32Value() == end_ref_offset.Uint32Value()) {
// While Reference.referent is not primitive, the ClassLinker
// treats it as such so that the garbage collector won't scan it.
- EXPECT_EQ(PrettyField(field),
- "java.lang.Object java.lang.ref.Reference.referent");
+ EXPECT_EQ(field->PrettyField(), "java.lang.Object java.lang.ref.Reference.referent");
} else {
current_ref_offset = MemberOffset(current_ref_offset.Uint32Value() +
sizeof(mirror::HeapReference<mirror::Object>));
@@ -1215,14 +1214,14 @@
REQUIRES_SHARED(Locks::mutator_lock_) {
if (!method->IsNative() && !method->IsAbstract()) {
EXPECT_EQ((method->GetAccessFlags() & kAccSkipAccessChecks) != 0U, verified)
- << PrettyMethod(method, true);
+ << method->PrettyMethod(true);
}
}
static void CheckVerificationAttempted(mirror::Class* c, bool preverified)
REQUIRES_SHARED(Locks::mutator_lock_) {
EXPECT_EQ((c->GetAccessFlags() & kAccVerificationAttempted) != 0U, preverified)
- << "Class " << PrettyClass(c) << " not as expected";
+ << "Class " << mirror::Class::PrettyClass(c) << " not as expected";
for (auto& m : c->GetMethods(kRuntimePointerSize)) {
CheckMethod(&m, preverified);
}