Enforce class definition ordering rules in v37 Dex files.
These new checks also reject classes extending or
implementing themselves directly or transitively within
a single Dex file.
Bug: 28812524
Bug: 28797012
Bug: 28685551
Bug: 27682580
Change-Id: I51c43f8b4b6a7abaade63682411e61f21767f5d4
diff --git a/runtime/dex_file.h b/runtime/dex_file.h
index ce7f62a..638821b 100644
--- a/runtime/dex_file.h
+++ b/runtime/dex_file.h
@@ -57,7 +57,11 @@
// TODO: move all of the macro functionality into the DexCache class.
class DexFile {
public:
+ // First Dex format version supporting default methods.
static const uint32_t kDefaultMethodsVersion = 37;
+ // First Dex format version enforcing class definition ordering rules.
+ static const uint32_t kClassDefinitionOrderEnforcedVersion = 37;
+
static const uint8_t kDexMagic[];
static constexpr size_t kNumDexVersions = 2;
static constexpr size_t kDexVersionLen = 4;