Using 'size' to mean anything other than "element count" on a collection is confusing.
This name was okay on Object itself, but it's confusing on its array subclasses.
Change-Id: I3d545d8c1001a157a68eefd34d6d411f4408ec9e
diff --git a/src/object.h b/src/object.h
index 5110992..6fe2ecf 100644
--- a/src/object.h
+++ b/src/object.h
@@ -129,7 +129,7 @@
bool InstanceOf(const Class* klass) const;
- size_t Size() const;
+ size_t SizeOf() const;
void MonitorEnter() {
monitor_->Enter();
@@ -603,6 +603,7 @@
size_t component_size) {
return sizeof(Array) + component_count * component_size;
}
+
static Array* Alloc(Class* array_class,
size_t component_count,
size_t component_size) {
@@ -614,7 +615,7 @@
return array;
}
- size_t Size() const;
+ size_t SizeOf() const;
int32_t GetLength() const {
return length_;
@@ -1174,14 +1175,14 @@
return klass_->IsArray();
}
-inline size_t Object::Size() const {
+inline size_t Object::SizeOf() const {
if (IsArray()) {
- return AsArray()->Size();
+ return AsArray()->SizeOf();
}
return klass_->object_size_;
}
-inline size_t Array::Size() const {
+inline size_t Array::SizeOf() const {
return Size(GetLength(), klass_->GetComponentSize());
}