ART: Finish old move of OatDexFile

The class has been made standalone so it can be forward-declared,
but not all nested references had been updated.

Test: mmma art
Change-Id: Idc5f0af24af17dcae286dee290f729ba61693a11
diff --git a/dex2oat/linker/oat_writer_test.cc b/dex2oat/linker/oat_writer_test.cc
index e43a7f3..7725c4d 100644
--- a/dex2oat/linker/oat_writer_test.cc
+++ b/dex2oat/linker/oat_writer_test.cc
@@ -446,8 +446,8 @@
   ASSERT_TRUE(java_lang_dex_file_ != nullptr);
   const DexFile& dex_file = *java_lang_dex_file_;
   uint32_t dex_file_checksum = dex_file.GetLocationChecksum();
-  const OatFile::OatDexFile* oat_dex_file = oat_file->GetOatDexFile(dex_file.GetLocation().c_str(),
-                                                                    &dex_file_checksum);
+  const OatDexFile* oat_dex_file = oat_file->GetOatDexFile(dex_file.GetLocation().c_str(),
+                                                           &dex_file_checksum);
   ASSERT_TRUE(oat_dex_file != nullptr);
   CHECK_EQ(dex_file.GetLocationChecksum(), oat_dex_file->GetDexFileLocationChecksum());
   ScopedObjectAccess soa(Thread::Current());
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index 2b0095ce..21ce8c8 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -115,10 +115,9 @@
 };
 
 // Map is so that we don't allocate multiple dex files for the same OatDexFile.
-static std::map<const OatFile::OatDexFile*,
-                std::unique_ptr<const DexFile>> opened_dex_files;
+static std::map<const OatDexFile*, std::unique_ptr<const DexFile>> opened_dex_files;
 
-const DexFile* OpenDexFile(const OatFile::OatDexFile* oat_dex_file, std::string* error_msg) {
+const DexFile* OpenDexFile(const OatDexFile* oat_dex_file, std::string* error_msg) {
   DCHECK(oat_dex_file != nullptr);
   auto it = opened_dex_files.find(oat_dex_file);
   if (it != opened_dex_files.end()) {
@@ -240,15 +239,15 @@
   }
 
   void Walk() {
-    std::vector<const OatFile::OatDexFile*> oat_dex_files = oat_file_->GetOatDexFiles();
+    std::vector<const OatDexFile*> oat_dex_files = oat_file_->GetOatDexFiles();
     for (size_t i = 0; i < oat_dex_files.size(); i++) {
-      const OatFile::OatDexFile* oat_dex_file = oat_dex_files[i];
+      const OatDexFile* oat_dex_file = oat_dex_files[i];
       CHECK(oat_dex_file != nullptr);
       WalkOatDexFile(oat_dex_file);
     }
   }
 
-  void WalkOatDexFile(const OatFile::OatDexFile* oat_dex_file) {
+  void WalkOatDexFile(const OatDexFile* oat_dex_file) {
     std::string error_msg;
     const DexFile* const dex_file = OpenDexFile(oat_dex_file, &error_msg);
     if (dex_file == nullptr) {
@@ -529,7 +528,7 @@
 
     // Dumping the dex file overview is compact enough to do even if header only.
     for (size_t i = 0; i < oat_dex_files_.size(); i++) {
-      const OatFile::OatDexFile* oat_dex_file = oat_dex_files_[i];
+      const OatDexFile* oat_dex_file = oat_dex_files_[i];
       CHECK(oat_dex_file != nullptr);
       std::string error_msg;
       const DexFile* const dex_file = OpenDexFile(oat_dex_file, &error_msg);
@@ -598,7 +597,7 @@
            << "\n";
       }
       for (size_t i = 0; i < oat_dex_files_.size(); i++) {
-        const OatFile::OatDexFile* oat_dex_file = oat_dex_files_[i];
+        const OatDexFile* oat_dex_file = oat_dex_files_[i];
         CHECK(oat_dex_file != nullptr);
         if (!DumpOatDexFile(os, *oat_dex_file)) {
           success = false;
@@ -630,7 +629,7 @@
 
       size_t i = 0;
       for (const auto& vdex_dex_file : vdex_dex_files) {
-        const OatFile::OatDexFile* oat_dex_file = oat_dex_files_[i];
+        const OatDexFile* oat_dex_file = oat_dex_files_[i];
         CHECK(oat_dex_file != nullptr);
         CHECK(vdex_dex_file != nullptr);
         if (!ExportDexFile(os, *oat_dex_file, vdex_dex_file.get())) {
@@ -670,7 +669,7 @@
 
   const void* GetQuickOatCode(ArtMethod* m) REQUIRES_SHARED(Locks::mutator_lock_) {
     for (size_t i = 0; i < oat_dex_files_.size(); i++) {
-      const OatFile::OatDexFile* oat_dex_file = oat_dex_files_[i];
+      const OatDexFile* oat_dex_file = oat_dex_files_[i];
       CHECK(oat_dex_file != nullptr);
       std::string error_msg;
       const DexFile* const dex_file = OpenDexFile(oat_dex_file, &error_msg);
@@ -786,7 +785,7 @@
     // region, so if we keep a sorted sequence of the start of each region, we can infer the length
     // of a piece of code by using upper_bound to find the start of the next region.
     for (size_t i = 0; i < oat_dex_files_.size(); i++) {
-      const OatFile::OatDexFile* oat_dex_file = oat_dex_files_[i];
+      const OatDexFile* oat_dex_file = oat_dex_files_[i];
       CHECK(oat_dex_file != nullptr);
       std::string error_msg;
       const DexFile* const dex_file = OpenDexFile(oat_dex_file, &error_msg);
@@ -825,7 +824,7 @@
     offsets_.insert(oat_method.GetVmapTableOffset());
   }
 
-  bool DumpOatDexFile(std::ostream& os, const OatFile::OatDexFile& oat_dex_file) {
+  bool DumpOatDexFile(std::ostream& os, const OatDexFile& oat_dex_file) {
     bool success = true;
     bool stop_analysis = false;
     os << "OatDexFile:\n";
@@ -906,9 +905,7 @@
   // Dex resource is extracted from the oat_dex_file and its checksum is repaired since it's not
   // unquickened. Otherwise the dex_file has been fully unquickened and is expected to verify the
   // original checksum.
-  bool ExportDexFile(std::ostream& os,
-                     const OatFile::OatDexFile& oat_dex_file,
-                     const DexFile* dex_file) {
+  bool ExportDexFile(std::ostream& os, const OatDexFile& oat_dex_file, const DexFile* dex_file) {
     std::string error_msg;
     std::string dex_file_location = oat_dex_file.GetDexFileLocation();
     size_t fsize = oat_dex_file.FileSize();
@@ -1717,7 +1714,7 @@
   }
 
   const OatFile& oat_file_;
-  const std::vector<const OatFile::OatDexFile*> oat_dex_files_;
+  const std::vector<const OatDexFile*> oat_dex_files_;
   const OatDumperOptions& options_;
   uint32_t resolved_addr2instr_;
   const InstructionSet instruction_set_;
@@ -1856,7 +1853,7 @@
 
     oat_dumper_.reset(new OatDumper(*oat_file, *oat_dumper_options_));
 
-    for (const OatFile::OatDexFile* oat_dex_file : oat_file->GetOatDexFiles()) {
+    for (const OatDexFile* oat_dex_file : oat_file->GetOatDexFiles()) {
       CHECK(oat_dex_file != nullptr);
       stats_.oat_dex_file_sizes.push_back(std::make_pair(oat_dex_file->GetDexFileLocation(),
                                                          oat_dex_file->FileSize()));
@@ -2782,7 +2779,7 @@
   OatFile* oat_file_ptr = oat_file.get();
   ClassLinker* class_linker = runtime->GetClassLinker();
   runtime->GetOatFileManager().RegisterOatFile(std::move(oat_file));
-  for (const OatFile::OatDexFile* odf : oat_file_ptr->GetOatDexFiles()) {
+  for (const OatDexFile* odf : oat_file_ptr->GetOatDexFiles()) {
     std::string error_msg;
     const DexFile* const dex_file = OpenDexFile(odf, &error_msg);
     CHECK(dex_file != nullptr) << error_msg;
diff --git a/runtime/art_method.cc b/runtime/art_method.cc
index 5b4dcb7..80b6921 100644
--- a/runtime/art_method.cc
+++ b/runtime/art_method.cc
@@ -550,7 +550,7 @@
 
 ArrayRef<const uint8_t> ArtMethod::GetQuickenedInfo() {
   const DexFile& dex_file = GetDeclaringClass()->GetDexFile();
-  const OatFile::OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
+  const OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
   if (oat_dex_file == nullptr || (oat_dex_file->GetOatFile() == nullptr)) {
     return ArrayRef<const uint8_t>();
   }
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 7b92ba4..c219d3d 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -1338,7 +1338,7 @@
     REQUIRES_SHARED(Locks::mutator_lock_) {
   DCHECK(error_msg != nullptr);
   std::unique_ptr<const DexFile> dex_file;
-  const OatFile::OatDexFile* oat_dex_file = oat_file->GetOatDexFile(location, nullptr, error_msg);
+  const OatDexFile* oat_dex_file = oat_file->GetOatDexFile(location, nullptr, error_msg);
   if (oat_dex_file == nullptr) {
     return std::unique_ptr<const DexFile>();
   }
@@ -4181,7 +4181,7 @@
     }
   }
 
-  const OatFile::OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
+  const OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
   // In case we run without an image there won't be a backing oat file.
   if (oat_dex_file == nullptr || oat_dex_file->GetOatFile() == nullptr) {
     return false;
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index e754fbc..cbce940 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -1875,7 +1875,7 @@
 
 bool ImageSpace::ValidateOatFile(const OatFile& oat_file, std::string* error_msg) {
   const ArtDexFileLoader dex_file_loader;
-  for (const OatFile::OatDexFile* oat_dex_file : oat_file.GetOatDexFiles()) {
+  for (const OatDexFile* oat_dex_file : oat_file.GetOatDexFiles()) {
     const std::string& dex_file_location = oat_dex_file->GetDexFileLocation();
 
     // Skip multidex locations - These will be checked when we visit their
@@ -1909,9 +1909,9 @@
       std::string multi_dex_location = DexFileLoader::GetMultiDexLocation(
           i,
           dex_file_location.c_str());
-      const OatFile::OatDexFile* multi_dex = oat_file.GetOatDexFile(multi_dex_location.c_str(),
-                                                                    nullptr,
-                                                                    error_msg);
+      const OatDexFile* multi_dex = oat_file.GetOatDexFile(multi_dex_location.c_str(),
+                                                           nullptr,
+                                                           error_msg);
       if (multi_dex == nullptr) {
         *error_msg = StringPrintf("ValidateOatFile oat file '%s' is missing entry '%s'",
                                   oat_file.GetLocation().c_str(),
diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc
index 9355ae7..8842942 100644
--- a/runtime/oat_file.cc
+++ b/runtime/oat_file.cc
@@ -1598,9 +1598,9 @@
   }
 }
 
-const OatFile::OatDexFile* OatFile::GetOatDexFile(const char* dex_location,
-                                                  const uint32_t* dex_location_checksum,
-                                                  std::string* error_msg) const {
+const OatDexFile* OatFile::GetOatDexFile(const char* dex_location,
+                                         const uint32_t* dex_location_checksum,
+                                         std::string* error_msg) const {
   // NOTE: We assume here that the canonical location for a given dex_location never
   // changes. If it does (i.e. some symlink used by the filename changes) we may return
   // an incorrect OatDexFile. As long as we have a checksum to check, we shall return
@@ -1609,7 +1609,7 @@
   // TODO: Additional analysis of usage patterns to see if this can be simplified
   // without any performance loss, for example by not doing the first lock-free lookup.
 
-  const OatFile::OatDexFile* oat_dex_file = nullptr;
+  const OatDexFile* oat_dex_file = nullptr;
   StringPiece key(dex_location);
   // Try to find the key cheaply in the oat_dex_files_ map which holds dex locations
   // directly mentioned in the oat file and doesn't require locking.
@@ -1667,17 +1667,17 @@
   return oat_dex_file;
 }
 
-OatFile::OatDexFile::OatDexFile(const OatFile* oat_file,
-                                const std::string& dex_file_location,
-                                const std::string& canonical_dex_file_location,
-                                uint32_t dex_file_location_checksum,
-                                const uint8_t* dex_file_pointer,
-                                const uint8_t* lookup_table_data,
-                                const IndexBssMapping* method_bss_mapping_data,
-                                const IndexBssMapping* type_bss_mapping_data,
-                                const IndexBssMapping* string_bss_mapping_data,
-                                const uint32_t* oat_class_offsets_pointer,
-                                const DexLayoutSections* dex_layout_sections)
+OatDexFile::OatDexFile(const OatFile* oat_file,
+                       const std::string& dex_file_location,
+                       const std::string& canonical_dex_file_location,
+                       uint32_t dex_file_location_checksum,
+                       const uint8_t* dex_file_pointer,
+                       const uint8_t* lookup_table_data,
+                       const IndexBssMapping* method_bss_mapping_data,
+                       const IndexBssMapping* type_bss_mapping_data,
+                       const IndexBssMapping* string_bss_mapping_data,
+                       const uint32_t* oat_class_offsets_pointer,
+                       const DexLayoutSections* dex_layout_sections)
     : oat_file_(oat_file),
       dex_file_location_(dex_file_location),
       canonical_dex_file_location_(canonical_dex_file_location),
@@ -1708,16 +1708,15 @@
   }
 }
 
-OatFile::OatDexFile::OatDexFile(TypeLookupTable&& lookup_table)
-    : lookup_table_(std::move(lookup_table)) {}
+OatDexFile::OatDexFile(TypeLookupTable&& lookup_table) : lookup_table_(std::move(lookup_table)) {}
 
-OatFile::OatDexFile::~OatDexFile() {}
+OatDexFile::~OatDexFile() {}
 
-size_t OatFile::OatDexFile::FileSize() const {
+size_t OatDexFile::FileSize() const {
   return reinterpret_cast<const DexFile::Header*>(dex_file_pointer_)->file_size_;
 }
 
-std::unique_ptr<const DexFile> OatFile::OatDexFile::OpenDexFile(std::string* error_msg) const {
+std::unique_ptr<const DexFile> OatDexFile::OpenDexFile(std::string* error_msg) const {
   ScopedTrace trace(__PRETTY_FUNCTION__);
   static constexpr bool kVerify = false;
   static constexpr bool kVerifyChecksum = false;
@@ -1732,11 +1731,11 @@
                               error_msg);
 }
 
-uint32_t OatFile::OatDexFile::GetOatClassOffset(uint16_t class_def_index) const {
+uint32_t OatDexFile::GetOatClassOffset(uint16_t class_def_index) const {
   return oat_class_offsets_pointer_[class_def_index];
 }
 
-OatFile::OatClass OatFile::OatDexFile::GetOatClass(uint16_t class_def_index) const {
+OatFile::OatClass OatDexFile::GetOatClass(uint16_t class_def_index) const {
   uint32_t oat_class_offset = GetOatClassOffset(class_def_index);
 
   const uint8_t* oat_class_pointer = oat_file_->Begin() + oat_class_offset;
@@ -1778,10 +1777,10 @@
                            reinterpret_cast<const OatMethodOffsets*>(methods_pointer));
 }
 
-const DexFile::ClassDef* OatFile::OatDexFile::FindClassDef(const DexFile& dex_file,
-                                                           const char* descriptor,
-                                                           size_t hash) {
-  const OatFile::OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
+const DexFile::ClassDef* OatDexFile::FindClassDef(const DexFile& dex_file,
+                                                  const char* descriptor,
+                                                  size_t hash) {
+  const OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
   DCHECK_EQ(ComputeModifiedUtf8Hash(descriptor), hash);
   bool used_lookup_table = false;
   const DexFile::ClassDef* lookup_table_classdef = nullptr;
@@ -1829,7 +1828,7 @@
                                                       dex_file.Begin() + dex_file.Size(),
                                                       MADV_RANDOM);
   }
-  const OatFile::OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
+  const OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
   if (oat_dex_file != nullptr) {
     // Should always be there.
     const DexLayoutSections* const sections = oat_dex_file->GetDexLayoutSections();
@@ -1947,7 +1946,7 @@
                                         uint16_t class_def_idx,
                                         bool* found) {
   DCHECK_NE(class_def_idx, DexFile::kDexNoIndex16);
-  const OatFile::OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
+  const OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
   if (oat_dex_file == nullptr || oat_dex_file->GetOatFile() == nullptr) {
     *found = false;
     return OatFile::OatClass::Invalid();
@@ -1956,7 +1955,7 @@
   return oat_dex_file->GetOatClass(class_def_idx);
 }
 
-void OatFile::OatDexFile::AssertAotCompiler() {
+void OatDexFile::AssertAotCompiler() {
   CHECK(Runtime::Current()->IsAotCompiler());
 }
 
diff --git a/runtime/oat_file.h b/runtime/oat_file.h
index d72b6a8..5f87bf0 100644
--- a/runtime/oat_file.h
+++ b/runtime/oat_file.h
@@ -70,8 +70,6 @@
   // Special classpath that skips shared library check.
   static constexpr const char* kSpecialSharedLibrary = "&";
 
-  typedef art::OatDexFile OatDexFile;
-
   // Opens an oat file contained within the given elf file. This is always opened as
   // non-executable at the moment.
   static OatFile* OpenWithElfFile(int zip_fd,
diff --git a/runtime/oat_file_assistant.cc b/runtime/oat_file_assistant.cc
index 6c869ca..f7c74cc 100644
--- a/runtime/oat_file_assistant.cc
+++ b/runtime/oat_file_assistant.cc
@@ -354,7 +354,7 @@
     std::vector<std::unique_ptr<const DexFile>>* out_dex_files) {
   // Load the main dex file.
   std::string error_msg;
-  const OatFile::OatDexFile* oat_dex_file = oat_file.GetOatDexFile(
+  const OatDexFile* oat_dex_file = oat_file.GetOatDexFile(
       dex_location.c_str(), nullptr, &error_msg);
   if (oat_dex_file == nullptr) {
     LOG(WARNING) << error_msg;
@@ -453,7 +453,7 @@
   for (uint32_t i = 0; i < number_of_dex_files; i++) {
     std::string dex = DexFileLoader::GetMultiDexLocation(i, dex_location_.c_str());
     uint32_t expected_checksum = (*required_dex_checksums)[i];
-    const OatFile::OatDexFile* oat_dex_file = file.GetOatDexFile(dex.c_str(), nullptr);
+    const OatDexFile* oat_dex_file = file.GetOatDexFile(dex.c_str(), nullptr);
     if (oat_dex_file == nullptr) {
       *error_msg = StringPrintf("failed to find %s in %s", dex.c_str(), file.GetLocation().c_str());
       return false;
@@ -921,7 +921,7 @@
         required_dex_checksums_found_ = true;
         for (size_t i = 0; i < odex_file->GetOatHeader().GetDexFileCount(); i++) {
           std::string dex = DexFileLoader::GetMultiDexLocation(i, dex_location_.c_str());
-          const OatFile::OatDexFile* odex_dex_file = odex_file->GetOatDexFile(dex.c_str(), nullptr);
+          const OatDexFile* odex_dex_file = odex_file->GetOatDexFile(dex.c_str(), nullptr);
           if (odex_dex_file == nullptr) {
             required_dex_checksums_found_ = false;
             break;
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 3b4d177..f7674c8 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -1020,7 +1020,7 @@
       return false;
     }
 
-    for (const OatFile::OatDexFile* oat_dex_file : oat_file->GetOatDexFiles()) {
+    for (const OatDexFile* oat_dex_file : oat_file->GetOatDexFiles()) {
       if (oat_dex_file == nullptr) {
         *failures += 1;
         continue;
diff --git a/test/117-nopatchoat/nopatchoat.cc b/test/117-nopatchoat/nopatchoat.cc
index 7c38258..a8a895a 100644
--- a/test/117-nopatchoat/nopatchoat.cc
+++ b/test/117-nopatchoat/nopatchoat.cc
@@ -28,7 +28,7 @@
 
 class NoPatchoatTest {
  public:
-  static const OatFile::OatDexFile* getOatDexFile(jclass cls) {
+  static const OatDexFile* getOatDexFile(jclass cls) {
     ScopedObjectAccess soa(Thread::Current());
     ObjPtr<mirror::Class> klass = soa.Decode<mirror::Class>(cls);
     const DexFile& dex_file = klass->GetDexFile();
@@ -42,13 +42,13 @@
   }
 
   static bool hasExecutableOat(jclass cls) {
-    const OatFile::OatDexFile* oat_dex_file = getOatDexFile(cls);
+    const OatDexFile* oat_dex_file = getOatDexFile(cls);
 
     return oat_dex_file != nullptr && oat_dex_file->GetOatFile()->IsExecutable();
   }
 
   static bool needsRelocation(jclass cls) {
-    const OatFile::OatDexFile* oat_dex_file = getOatDexFile(cls);
+    const OatDexFile* oat_dex_file = getOatDexFile(cls);
 
     if (oat_dex_file == nullptr) {
       return false;
diff --git a/test/common/runtime_state.cc b/test/common/runtime_state.cc
index f89888b..f2da6fe 100644
--- a/test/common/runtime_state.cc
+++ b/test/common/runtime_state.cc
@@ -60,7 +60,7 @@
 
   ObjPtr<mirror::Class> klass = soa.Decode<mirror::Class>(cls);
   const DexFile& dex_file = klass->GetDexFile();
-  const OatFile::OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
+  const OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
   return (oat_dex_file != nullptr) ? JNI_TRUE : JNI_FALSE;
 }
 
@@ -100,7 +100,7 @@
 
   ObjPtr<mirror::Class> klass = soa.Decode<mirror::Class>(cls);
   const DexFile& dex_file = klass->GetDexFile();
-  const OatFile::OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
+  const OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
   if (oat_dex_file == nullptr) {
     // Could be JIT, which also uses optimizing, but conservatively say no.
     return JNI_FALSE;