ObjPtr<>-ify mirror::Object::As*(), fix stale refs in test.

Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 31113334
Change-Id: Ia04c4996f5cbfa1f26acbadcd747342c57b1aac3
diff --git a/runtime/class_loader_context.cc b/runtime/class_loader_context.cc
index e890c1f..66d134e 100644
--- a/runtime/class_loader_context.cc
+++ b/runtime/class_loader_context.cc
@@ -865,7 +865,7 @@
     return true;
   }
   // On the Java side, the dex files are stored in the cookie field.
-  mirror::LongArray* long_array = cookie_field->GetObject(java_dex_file)->AsLongArray();
+  ObjPtr<mirror::LongArray> long_array = cookie_field->GetObject(java_dex_file)->AsLongArray();
   if (long_array == nullptr) {
     // This should never happen so log a warning.
     LOG(ERROR) << "Unexpected null cookie";