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/openjdkjvmti/ti_class_definition.cc b/openjdkjvmti/ti_class_definition.cc
index c4287fb..ec267155 100644
--- a/openjdkjvmti/ti_class_definition.cc
+++ b/openjdkjvmti/ti_class_definition.cc
@@ -154,8 +154,7 @@
if (!orig_dex.IsNull()) {
if (orig_dex->IsArrayInstance()) {
DCHECK(orig_dex->GetClass()->GetComponentType()->IsPrimitiveByte());
- art::Handle<art::mirror::ByteArray> orig_dex_bytes(
- hs.NewHandle(art::down_cast<art::mirror::ByteArray*>(orig_dex->AsArray())));
+ art::Handle<art::mirror::ByteArray> orig_dex_bytes(hs.NewHandle(orig_dex->AsByteArray()));
dex_data->resize(orig_dex_bytes->GetLength());
memcpy(dex_data->data(), orig_dex_bytes->GetData(), dex_data->size());
return;