summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2024-11-25 10:30:20 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2024-11-26 10:20:28 +0000
commit8ec33c0a3019cd2f14f0dd234effa6b2dcbb34b8 (patch)
tree4137175dcad05be5a0632a30d18568e88ecfd0cd
parent54cd7bf45839805d7f0f2708a6c9a65c70ca154a (diff)
Add a fast path for `Class::CanAccess`.
A class can access itself. Test: test.py Change-Id: Ib1f18788b99d94ca808f74827623fc9999d5faf0
-rw-r--r--runtime/mirror/class-inl.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/mirror/class-inl.h b/runtime/mirror/class-inl.h
index 20b5f463f0..3d3c71759b 100644
--- a/runtime/mirror/class-inl.h
+++ b/runtime/mirror/class-inl.h
@@ -1284,7 +1284,7 @@ inline void Class::FixupNativePointers(Class* dest,
}
inline bool Class::CanAccess(ObjPtr<Class> that) {
- return that->IsPublic() || this->IsInSamePackage(that);
+ return this == that || that->IsPublic() || this->IsInSamePackage(that);
}