Move remaining jobject related functions to use ObjPtr

Also added ObjPtr::DownCast.

Bug: 31113334

Test: test-art-host

Change-Id: I59c253211dc435579ffdfd49f856861ab13d262c
diff --git a/runtime/class_linker-inl.h b/runtime/class_linker-inl.h
index 378da57..fa971c4 100644
--- a/runtime/class_linker-inl.h
+++ b/runtime/class_linker-inl.h
@@ -26,6 +26,7 @@
 #include "mirror/iftable.h"
 #include "mirror/object_array.h"
 #include "handle_scope-inl.h"
+#include "scoped_thread_state_change-inl.h"
 
 #include <atomic>
 
@@ -247,8 +248,8 @@
       if (!self->IsJWeakCleared(data.weak_root) &&
           proxy_method->HasSameDexCacheResolvedTypes(data.resolved_types,
                                                      image_pointer_size_)) {
-        mirror::DexCache* dex_cache = down_cast<mirror::DexCache*>(
-            self->DecodeJObject(data.weak_root));
+        ObjPtr<mirror::DexCache> dex_cache =
+            ObjPtr<mirror::DexCache>::DownCast(self->DecodeJObject(data.weak_root));
         if (dex_cache != nullptr) {
           ArtMethod* resolved_method = dex_cache->GetResolvedMethod(
               proxy_method->GetDexMethodIndex(), image_pointer_size_);