art: JVMTI unhiding API cleanup

This is a follow-up commit to 751510 to use the dex_file UnhideApis()
function instead of reimplementing the unhide iterators.

Test: art/test/testrunner/testrunner.py --interp-ac --target \
      -t 980-redefine-object -t 983-source-transform-verify

Change-Id: Ib3e872aa9a350cdf2b1461373735a99d956b5a38
Signed-off-by: Anestis Bechtsoudis <anestis@census-labs.com>
diff --git a/openjdkjvmti/fixed_up_dex_file.cc b/openjdkjvmti/fixed_up_dex_file.cc
index 2ca87fd..aedec27 100644
--- a/openjdkjvmti/fixed_up_dex_file.cc
+++ b/openjdkjvmti/fixed_up_dex_file.cc
@@ -51,17 +51,6 @@
       dex_file->CalculateChecksum();
 }
 
-static void UnhideApis(const art::DexFile& target_dex_file) {
-  for (art::ClassAccessor accessor : target_dex_file.GetClasses()) {
-    for (const art::ClassAccessor::Field& field : accessor.GetFields()) {
-      field.UnHideAccessFlags();
-    }
-    for (const art::ClassAccessor::Method& method : accessor.GetMethods()) {
-      method.UnHideAccessFlags();
-    }
-  }
-}
-
 static const art::VdexFile* GetVdex(const art::DexFile& original_dex_file) {
   const art::OatDexFile* oat_dex = original_dex_file.GetOatDexFile();
   if (oat_dex == nullptr) {
@@ -80,7 +69,7 @@
   if (vdex != nullptr) {
     vdex->UnquickenDexFile(new_dex_file, original_dex_file, /* decompile_return_instruction */true);
   }
-  UnhideApis(new_dex_file);
+  new_dex_file.UnhideApis();
 }
 
 static void DCheckVerifyDexFile(const art::DexFile& dex) {