summaryrefslogtreecommitdiffstats
path: root/runtime/reflection.cc
diff options
context:
space:
mode:
authorJeff Hao <jeffhao@google.com>2014-03-28 15:43:37 -0700
committerJeff Hao <jeffhao@google.com>2014-03-28 15:43:37 -0700
commitcb4581aa13d6f43f705535818a4d0893d551be3a (patch)
tree903cbcb3852650c7e3105c0c1819e6e480091cd4 /runtime/reflection.cc
parente759c9f01b558093466fc78f01900042120cd832 (diff)
downloadart-cb4581aa13d6f43f705535818a4d0893d551be3a.zip
art-cb4581aa13d6f43f705535818a4d0893d551be3a.tar.gz
art-cb4581aa13d6f43f705535818a4d0893d551be3a.tar.bz2
Some fixes for comments and implied conversions.
Addresses comments in: https://android-review.googlesource.com/#/c/89148/3 Change-Id: If21cfaa541210c8702371efd1e6d4f071a7b9ec3
Diffstat (limited to 'runtime/reflection.cc')
-rw-r--r--runtime/reflection.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/runtime/reflection.cc b/runtime/reflection.cc
index b38f9b4..6ed61f6 100644
--- a/runtime/reflection.cc
+++ b/runtime/reflection.cc
@@ -500,8 +500,8 @@ jobject InvokeMethod(const ScopedObjectAccess& soa, jobject javaMethod,
return NULL;
}
- // Validate access.
- if (!accessible && !ValidateAccess(receiver, declaring_class, m->GetAccessFlags())) {
+ // If method is not set to be accessible, verify it can be accessed by the caller.
+ if (!accessible && !VerifyAccess(receiver, declaring_class, m->GetAccessFlags())) {
ThrowIllegalAccessException(nullptr, StringPrintf("Cannot access method: %s",
PrettyMethod(m).c_str()).c_str());
return nullptr;
@@ -794,19 +794,19 @@ bool UnboxPrimitiveForResult(const ThrowLocation& throw_location, mirror::Object
return UnboxPrimitive(&throw_location, o, dst_class, nullptr, unboxed_value);
}
-bool ValidateAccess(mirror::Object* obj, mirror::Class* declaring_class, uint32_t access_flags) {
+bool VerifyAccess(mirror::Object* obj, mirror::Class* declaring_class, uint32_t access_flags) {
NthCallerVisitor visitor(Thread::Current(), 2);
visitor.WalkStack();
mirror::Class* caller_class = visitor.caller->GetDeclaringClass();
- if (((access_flags & kAccPublic) && declaring_class->IsPublic()) ||
+ if ((((access_flags & kAccPublic) != 0) && declaring_class->IsPublic()) ||
caller_class == declaring_class) {
return true;
}
- if (access_flags & kAccPrivate) {
+ if ((access_flags & kAccPrivate) != 0) {
return false;
}
- if (access_flags & kAccProtected) {
+ if ((access_flags & kAccProtected) != 0) {
if (obj != nullptr && !obj->InstanceOf(caller_class) &&
!declaring_class->IsInSamePackage(caller_class)) {
return false;