Use ArtMethod::GetDex{File,Cache}() more.

Do not go through the declaring class when it can cause
a DexFile or DexCache mismatch for obsolete methods.

Also fix similar potential mismatch in hiddenapi.

This is a follow-up to
    https://android-review.googlesource.com/834082 ,
    https://android-review.googlesource.com/836008 .

Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 119830111
Change-Id: I3fdf1aa1bc7bab816d5d8034b107506a32438b77
diff --git a/runtime/quick_exception_handler.cc b/runtime/quick_exception_handler.cc
index afdfefa..d23f3e8 100644
--- a/runtime/quick_exception_handler.cc
+++ b/runtime/quick_exception_handler.cc
@@ -238,7 +238,7 @@
         LOG(INFO) << "Handler is upcall";
       }
       if (handler_method_ != nullptr) {
-        const DexFile* dex_file = handler_method_->GetDeclaringClass()->GetDexCache()->GetDexFile();
+        const DexFile* dex_file = handler_method_->GetDexFile();
         int line_number = annotations::GetLineNumFromPC(dex_file, handler_method_, handler_dex_pc_);
         LOG(INFO) << "Handler: " << handler_method_->PrettyMethod() << " (line: "
                   << line_number << ")";