Clean up access checks.
Change-Id: Ia62ba6c8f1d0a9bfbbfde2d7be4c52c0f982b9d2
diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h
index 9aa23d9..d751363 100644
--- a/runtime/mirror/class.h
+++ b/runtime/mirror/class.h
@@ -18,6 +18,7 @@
#define ART_RUNTIME_MIRROR_CLASS_H_
#include "gc/heap.h"
+#include "invoke_type.h"
#include "modifiers.h"
#include "object.h"
#include "primitive.h"
@@ -449,6 +450,20 @@
return this->IsInSamePackage(access_to);
}
+ // Can this class access a resolved field?
+ // Note that access to field's class is checked and this may require looking up the class
+ // referenced by the FieldId in the DexFile in case the declaring class is inaccessible.
+ template <bool throw_on_failure>
+ bool CanAccessResolvedField(Class* access_to, ArtField* field,
+ uint32_t field_idx) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
+ // Can this class access a resolved method?
+ // Note that access to methods's class is checked and this may require looking up the class
+ // referenced by the MethodId in the DexFile in case the declaring class is inaccessible.
+ template <bool throw_on_failure, InvokeType throw_invoke_type = kStatic>
+ bool CanAccessResolvedMethod(Class* access_to, ArtMethod* resolved_method,
+ uint32_t method_idx) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
bool IsSubClass(const Class* klass) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);