Refactor the use of Method by the compiler.

Remove the dependence on the Method object in dex2oat, allowing lazier
resolution.
Introduce new find and iterators in DexFile to simplify common
operations and avoid misuse of class data items.

Change-Id: I39fb8252190f543d89d8b233076355cec310fe08
diff --git a/src/image_test.cc b/src/image_test.cc
index 3e64d95..88ddae9 100644
--- a/src/image_test.cc
+++ b/src/image_test.cc
@@ -21,6 +21,14 @@
   bool success_oat = OatWriter::Create(tmp_oat.GetFile(), NULL, *compiler_.get());
   ASSERT_TRUE(success_oat);
 
+  // Force all system classes into memory
+  for (size_t i = 0; i < java_lang_dex_file_->NumClassDefs(); i++) {
+    const DexFile::ClassDef& class_def = java_lang_dex_file_->GetClassDef(i);
+    const char* descriptor = java_lang_dex_file_->GetClassDescriptor(class_def);
+    Class* klass = class_linker_->FindSystemClass(descriptor);
+    EXPECT_TRUE(klass != NULL) << descriptor;
+  }
+
   ImageWriter writer;
   ScratchFile tmp_image;
   const uintptr_t requested_image_base = 0x60000000;