Use accessor methods for Object fields.
Ensure that Object fields are modified via accessors so that it's easy
to insert barriers (make all fields within Objects private). Add validity
checks to Field and Method accessors to ensure they are accessed when a
Class is in a suitable state. Add validity checks to all Object
accessors to check heap isn't corrupted. Remove hacked in strings from Field
and Method; make type fields used the dex cache that is lazily initialized.
Clean up various other TODOs and lint issues.
Change-Id: Iac0afc515c01f5419874d9cdcdb9a7b45443e3fb
diff --git a/src/class_loader.h b/src/class_loader.h
index da19539..3309a8a 100644
--- a/src/class_loader.h
+++ b/src/class_loader.h
@@ -10,13 +10,14 @@
namespace art {
-// ClassLoader objects.
+// C++ mirror of java.lang.ClassLoader
class ClassLoader : public Object {
public:
static const std::vector<const DexFile*>& GetClassPath(const ClassLoader* class_loader);
void SetClassPath(std::vector<const DexFile*>& class_path) {
DCHECK_EQ(0U, class_path_.size());
+ // TODO: use setter
class_path_ = class_path;
}
@@ -31,6 +32,7 @@
DISALLOW_IMPLICIT_CONSTRUCTORS(ClassLoader);
};
+// C++ mirror of dalvik.system.BaseDexClassLoader
class BaseDexClassLoader : public ClassLoader {
private:
// Field order required by test "ValidateFieldOrderOfJavaCppUnionClasses".
@@ -39,6 +41,7 @@
DISALLOW_IMPLICIT_CONSTRUCTORS(BaseDexClassLoader);
};
+// C++ mirror of dalvik.system.PathClassLoader
class PathClassLoader : public BaseDexClassLoader {
public:
static const PathClassLoader* Alloc(std::vector<const DexFile*> dex_files);