Expanding ClassLinkerTest/LibCore to cover more Class details
- Ensure SetReferenceOffsets is always called
- Change Field to use StringPiece instead of const char*
- Removed "shrunk vtable" logging noise
- Fix small bug in Class::Status logging
- Rename Field signature to descriptor for clarity
- Add Class:IsSynthetic
Change-Id: I453f480ad7a87a6a391418684771c92d62f116c9
diff --git a/src/object.h b/src/object.h
index a154959..77eb164 100644
--- a/src/object.h
+++ b/src/object.h
@@ -250,16 +250,16 @@
return declaring_class_;
}
- const char* GetName() const {
+ const StringPiece& GetName() const {
return name_;
}
char GetType() const { // TODO: return type
- return signature_[0];
+ return descriptor_[0];
}
- const char* GetSignature() const {
- return signature_;
+ const StringPiece& GetDescriptor() const {
+ return descriptor_;
}
public: // TODO: private
@@ -277,10 +277,10 @@
// The class in which this field is declared.
Class* declaring_class_;
- const char* name_;
+ StringPiece name_;
// e.g. "I", "[C", "Landroid/os/Debug;"
- const char* signature_;
+ StringPiece descriptor_;
uint32_t access_flags_;
@@ -373,8 +373,7 @@
class Method : public Object {
public:
- // Returns the method name.
- // TODO: example
+ // Returns the method name, e.g. "<init>" or "eatLunch"
const StringPiece& GetName() const {
return name_;
}
@@ -749,6 +748,11 @@
return primitive_type_ != kPrimNot;
}
+ // Returns true if the class is synthetic.
+ bool IsSynthetic() const {
+ return (access_flags_ & kAccSynthetic) != 0;
+ }
+
// Returns true if this class can access that class.
bool CanAccess(const Class* that) const {
return that->IsPublic() || this->IsInSamePackage(that);