Don't resolve types in verifier when we can't load classes.
Added a boolean parameter to GetReturnType which tells us whether or
not we can resolve types. We pass in can_load_classes_.
Bug: 11689500
Change-Id: Ib3d35f441e08c2409ce14ac269854012dc978ddd
diff --git a/runtime/object_utils.h b/runtime/object_utils.h
index 084e1e2..407aa65 100644
--- a/runtime/object_utils.h
+++ b/runtime/object_utils.h
@@ -417,12 +417,12 @@
return GetDexFile().GetProtoParameters(proto);
}
- mirror::Class* GetReturnType() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+ mirror::Class* GetReturnType(bool resolve = true) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
const DexFile& dex_file = GetDexFile();
const DexFile::MethodId& method_id = dex_file.GetMethodId(method_->GetDexMethodIndex());
const DexFile::ProtoId& proto_id = dex_file.GetMethodPrototype(method_id);
uint16_t return_type_idx = proto_id.return_type_idx_;
- return GetClassFromTypeIdx(return_type_idx);
+ return GetClassFromTypeIdx(return_type_idx, resolve);
}
const char* GetReturnTypeDescriptor() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
@@ -532,10 +532,10 @@
return method_->GetDexCacheResolvedTypes()->Get(type_idx) != NULL;
}
- mirror::Class* GetClassFromTypeIdx(uint16_t type_idx)
+ mirror::Class* GetClassFromTypeIdx(uint16_t type_idx, bool resolve = true)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
mirror::Class* type = method_->GetDexCacheResolvedTypes()->Get(type_idx);
- if (type == NULL) {
+ if (type == NULL && resolve) {
type = GetClassLinker()->ResolveType(type_idx, method_);
CHECK(type != NULL || Thread::Current()->IsExceptionPending());
}