ObjPtr misc cleanup
Check for subtypes in constructor.
Remove various calls to MakeObjPtr and ObjPtr::Ptr.
Bug: 31113334
Test: test-art-host
Change-Id: I8d680d514ea52cd64fc4f7c2e988926bc726174e
diff --git a/runtime/native/java_lang_Class.cc b/runtime/native/java_lang_Class.cc
index 87bff5f..2a5c04d 100644
--- a/runtime/native/java_lang_Class.cc
+++ b/runtime/native/java_lang_Class.cc
@@ -677,11 +677,10 @@
if (caller.Get() == nullptr) {
caller.Assign(GetCallingClass(soa.Self(), 1));
}
- if (UNLIKELY(caller.Get() != nullptr && !VerifyAccess(
- MakeObjPtr(receiver.Get()),
- MakeObjPtr(declaring_class),
- constructor->GetAccessFlags(),
- MakeObjPtr(caller.Get())))) {
+ if (UNLIKELY(caller.Get() != nullptr && !VerifyAccess(receiver.Get(),
+ declaring_class,
+ constructor->GetAccessFlags(),
+ caller.Get()))) {
soa.Self()->ThrowNewExceptionF(
"Ljava/lang/IllegalAccessException;", "%s is not accessible from %s",
PrettyMethod(constructor).c_str(), PrettyClass(caller.Get()).c_str());
diff --git a/runtime/native/java_lang_reflect_Field.cc b/runtime/native/java_lang_reflect_Field.cc
index 86b42d0..90def44 100644
--- a/runtime/native/java_lang_reflect_Field.cc
+++ b/runtime/native/java_lang_reflect_Field.cc
@@ -46,8 +46,8 @@
}
ObjPtr<mirror::Class> calling_class;
if (!VerifyAccess(self,
- MakeObjPtr(obj),
- MakeObjPtr(field->GetDeclaringClass()),
+ obj,
+ field->GetDeclaringClass(),
field->GetAccessFlags(),
&calling_class,
1)) {
@@ -335,7 +335,7 @@
ObjPtr<mirror::Object> boxed_value = soa.Decode<mirror::Object>(javaValue);
JValue unboxed_value;
if (!UnboxPrimitiveForField(boxed_value,
- MakeObjPtr(field_type),
+ field_type,
f->GetArtField(),
&unboxed_value)) {
DCHECK(soa.Self()->IsExceptionPending());